<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wordpress API &#187; Ruby on Rails</title>
	<atom:link href="http://wordpressapi.com/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpressapi.com</link>
	<description>Wordpress Tutorials, Tips, Code, Hacks, Themes, plugin, Developer Code book -Wordpress Code, Themes, Plugins, Tips, Tutorials, News, Releases, Designs, Hacks, Tricks, Blog</description>
	<lastBuildDate>Wed, 25 Jan 2012 18:48:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Active Model in Rails 3.0</title>
		<link>http://wordpressapi.com/2010/07/04/active-model-rails-3-0/</link>
		<comments>http://wordpressapi.com/2010/07/04/active-model-rails-3-0/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 07:25:09 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ROR]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=4043</guid>
		<description><![CDATA[http://wordpressapi.com/2010/07/04/active-model-rails-3-0/The technique we used was quite a hack as this is something that ActiveRecord wasn’t designed to do but now in Rails 3.0 we have a new feature called ActiveModel which makes doing something like this a lot easier. Before &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/07/04/active-model-rails-3-0/<p>The technique we used was quite a hack as this is something that  ActiveRecord wasn’t designed to do but now in Rails 3.0 we have a new  feature called ActiveModel which makes doing something like this a lot  easier.</p>
<p>Before we get into the details of ActiveModel we’ll first describe  the part of the application that we’re going to modify to use it.</p>
<p><a href="http://images.wordpressapi.com/active-record.png"><img class="alignnone size-full wp-image-4044" title="active-record" src="http://images.wordpressapi.com/active-record.png" alt="" width="801" height="465" /></a></p>
<p>The screenshot above shows a contact form that has been created using  Rails’ scaffolding. The application has a model called <code>Message</code> that is currently backed by ActiveRecord which means that we’re  managing messages through the database. We’re going to change the way  this form works so that it just sends emails and doesn’t store messages  in a database table.</p>
<p>When you’re thinking of doing something like this it’s always a good  idea to first consider your requirements and make sure that you really  don’t want to store the data from the form in a database as there are  often good side-effects to doing this. A database can act as a backup  and also makes it easier to move the message-sending into a queue in a  background process. For the purposes of this example, however, we don’t  want any of that  functionality so we’re free to go ahead and make our  model tableless.</p>
<p>The code for the Message class looks like this:</p>
<p>File name: /app/models/message.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class Message &lt; ActiveRecord::Base
 validates_presence_of :name
 validates_format_of :email, :with =&gt; /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
 validates_length_of :content, :maximum =&gt; 500
end
</pre>
<p><code>Message</code> inherits from <code>ActiveRecord::Base</code> as  you would expect a model class to, but as we don’t want this model to  have a database back-end we’re going to remove that inheritance. As soon  as we do this, though, our form will no longer work as the validators  are provided by ActiveRecord. Fortunately, we can restore this  functionality by using ActiveModel.</p>
<p>If we take a look at the <a href="http://github.com/rails/rails/">Rails  3 source code</a> we’ll see the that there are <code>activerecord</code> and <code>activemodel</code> directories. The core Rails team has taken  everything from ActiveRecord that wasn’t specific to the database  backend and moved it out into ActiveModel. ActiveRecord still relies  heavily on ActiveModel for the functionality that isn’t specific to the  database and as ActiveModel is full-featured and thoroughly tested it’s  great for use outside ActiveRecord.</p>
<p>It we take a look in the directory that contains the <a href="http://github.com/rails/rails/tree/master/activemodel/lib/active_model/">code  for ActiveModel</a> we can see the functionality that it provides.</p>
<p>We can see from the list above that ActiveModel includes code to  handle callbacks, dirty tracking, serialization and validation, among  other things. The last of these is exactly what we’re looking for.</p>
<p>The <a href="http://github.com/rails/rails/blob/master/activemodel/lib/active_model/validations.rb">code  for validations</a> has the following comment near the top and we can  see from it that it’s fairly easy to add validations to a model. All we  need to do is include the <code>Validations</code> module and provide  getter methods for the attributes that we’re calling validators on.</p>
<p>Now that we know this we can apply it to our Message model.</p>
<p>File name: /app/models/message.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class Message
 include ActiveModel::Validations

 attr_accessor :name, :email, :content

 validates_presence_of :name
 validates_format_of :email, :with =&gt; /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
 validates_length_of :content, :maximum =&gt; 500
end
</pre>
<p><code>Message</code> inherits from <code>ActiveRecord::Base</code> as  you would expect a model class to, but as we don’t want this model to  have a database back-end we’re going to remove that inheritance. As soon  as we do this, though, our form will no longer work as the validators  are provided by ActiveRecord. Fortunately, we can restore this  functionality by using ActiveModel.</p>
<p>If we take a look at the <a href="http://github.com/rails/rails/">Rails  3 source code</a> we’ll see the that there are <code>activerecord</code> and <code>activemodel</code> directories. The core Rails team has taken  everything from ActiveRecord that wasn’t specific to the database  backend and moved it out into ActiveModel. ActiveRecord still relies  heavily on ActiveModel for the functionality that isn’t specific to the  database and as ActiveModel is full-featured and thoroughly tested it’s  great for use outside ActiveRecord.</p>
<p>It we take a look in the directory that contains the <a href="http://github.com/rails/rails/tree/master/activemodel/lib/active_model/">code  for ActiveModel</a> we can see the functionality that it provides.</p>
<p>We can see from the list above that ActiveModel includes code to  handle callbacks, dirty tracking, serialization and validation, among  other things. The last of these is exactly what we’re looking for.</p>
<p>The <a href="http://github.com/rails/rails/blob/master/activemodel/lib/active_model/validations.rb">code  for validations</a> has the following comment near the top and we can  see from it that it’s fairly easy to add validations to a model. All we  need to do is include the <code>Validations</code> module and provide  getter methods for the attributes that we’re calling validators on.</p>
<p>Now that we know this we can apply it to our Message model.</p>
<p>File name: /app/models/message.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class Message
 include ActiveModel::Validations

 attr_accessor :name, :email, :content

 validates_presence_of :name
 validates_format_of :email, :with =&gt; /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
 validates_length_of :content, :maximum =&gt; 500
end
</pre>
<p>This isn’t enough to get our model to behave as the controller expects  it to, though. There are two problems in the <code>create</code> method.  Firstly the call to <code>Message.new</code> won’t work as our <code>Message</code> model no longer has an initializer that takes a hash of attributes as  an argument. Secondly, <code>save</code> won’t work as we don’t have a  database backend to save the new message to.</p>
<p>Filename : /apps/controllers/messages_controller.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class MessagesController &lt; ApplicationController
 def new
 @message = Message.new
 end

def create
 @message = Message.new(params[:message])
 if @message.save
 # TODO send message here
 flash[:notice] = &quot;Message sent! Thank you for contacting us.&quot;
 redirect_to root_url
 else
 render :action =&gt; 'new'
 end
 end
end
</pre>
<p>We’ll fix the second of these problems first. While we can’t save a  message we can check that it is valid, so we’ll replace <code>@message.save</code> with <code>@message.valid?</code>.</p>
<p>File name :/app/controllers/messages_controllers.rb</p>
<pre class="brush: ruby; title: ; notranslate">

def create
 @message = Message.new(params[:message])
 if @message.valid?
 # TODO send message here
 flash[:notice] = &quot;Message sent! Thank you for contacting us.&quot;
 redirect_to root_url
 else
 render :action =&gt; 'new'
 end
end
</pre>
<p>We can solve the first problem by writing an <code>initialize</code> method in the <code>Message</code> model that takes a hash as a  parameter. This method will loop through each item in the hash and  assign the value to the appropriate attribute for the message using the <code>send</code> method.</p>
<p>File name: /app/models/message.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class Message
 include ActiveModel::Validations

attr_accessor :name, :email, :content
 validates_presence_of :name
 validates_format_of :email, :with =&gt; /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
 validates_length_of :content, :maximum =&gt; 500
 def initialize(attributes = {})
 attributes.each do |name, value|
 send(&quot;#{name}=&quot;, value)
 end
 end
end
</pre>
<p>If we reload the form now we’ll see that we’re not quite there yet,  however.</p>
<p>This time the error is caused by a missing <code>to_key</code> method  in the <code>Message</code> model. The error is thrown by the <code>form_for</code> method so it seems that Rails itself is expecting our model to have  functionality that it doesn’t yet support. Let’s add that functionality  now.</p>
<p>Rather than guessing everything that Rails expects the model to have  there’s a nice <a href="http://github.com/rails/rails/blob/master/activemodel/lib/active_model/lint.rb">lint  test</a> included with ActiveModel that allows us to check whether our  custom model behaves as Rails expects it to. If we include the <code>ActiveModel::Lint::Tests</code> module in a tests for the model it will check that the model has all of  the required functionality.</p>
<p>The source code for the <code>Lint::Tests</code> module shows the  methods that the model needs to respond to in order for it to work as it  should, including <code>to_key</code>. We can make our model work by  including a couple of ActiveRecord modules. The first of these is <a href="http://github.com/rails/rails/blob/master/activemodel/lib/active_model/conversion.rb"><code>Conversion</code></a>,  which provides that to_key method and several others. The other module  is the <a href="http://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb"><code>Naming</code></a> module, but in this case we extend it in our class rather than  including it as it includes some class methods.</p>
<p>As well as including the <code>Conversion</code> module we need to  define a <code>persisted?</code> method in our model, which needs to  return <code>false</code> as our model isn’t persisted to a database.  With these changes in place our <code>Message</code> model now looks  like this:</p>
<p>File name: /app/models/message.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class Message
 include ActiveModel::Validations
 include ActiveModel::Conversion
 extend ActiveModel::Naming
 attr_accessor :name, :email, :content
 validates_presence_of :name
 validates_format_of :email, :with =&gt; /^[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}$/i
 validates_length_of :content, :maximum =&gt; 500
 def initialize(attributes = {})
 attributes.each do |name, value|
 send(&quot;#{name}=&quot;, value)
 end
 end
 def persisted?
 false
 end
end
</pre>
<p>If we reload the form now it will work again which means that the <code>Message</code> model now satisfies all of the requirements that Rails 3 relies on for a  model. If we try to submit the form we’ll see that the validators are  working, too.</p>
<p><a href="http://images.wordpressapi.com/active-record1.png"><img class="alignnone size-full wp-image-4045" title="active-record1" src="http://images.wordpressapi.com/active-record1.png" alt="" width="800" height="631" /></a></p>
<p>We’ve only covered a little of what ActiveModel provides in this episode  but this should have been enough to whet your appetite and give you a  reason to look more deeply into its source code to see what it can do.  The code is well documented and structured so if you see something you  might find useful then there should be enough information in the  comments for that file to get you started using it.</p>
<p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/07/04/active-model-rails-3-0/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Ruby 1.8.7-p299 version is released</title>
		<link>http://wordpressapi.com/2010/06/25/ruby-1-8-7-p299-version-released/</link>
		<comments>http://wordpressapi.com/2010/06/25/ruby-1-8-7-p299-version-released/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 05:50:38 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=3591</guid>
		<description><![CDATA[http://wordpressapi.com/2010/06/25/ruby-1-8-7-p299-version-released/Today Ruby released the new version of ruby &#8211; Ruby 1.8.7-p299. It is avaible for download from following URLs: * ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.gz * ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.bz2 * ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.zip Hello all. It&#8217;s time for a new release of 1.8.7. This time Ruby fixed various &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/06/25/ruby-1-8-7-p299-version-released/<p><a href="http://images.wordpressapi.com/Ruby-1.8.7-p299-released._1277442860108.png"><img class="alignnone size-full wp-image-3592" title="Ruby 1.8.7-p299 released._1277442860108" src="http://images.wordpressapi.com/Ruby-1.8.7-p299-released._1277442860108.png" alt="" width="316" height="126" /></a></p>
<p>Today Ruby released the new version of ruby &#8211; Ruby 1.8.7-p299. It is avaible for download from following URLs:<br />
* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.gz<br />
* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.bz2<br />
* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.zip</p>
<p>Hello all. It&#8217;s time for a new release of 1.8.7.</p>
<p>This time Ruby fixed various bugs, including the Unicode inspection bug that annoyed you a lot. For a complete list of what has been fixed, please take a look at the ChangeLog.</p>
<p>* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.gz<br />
* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.tar.bz2<br />
* ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p299.zip</p>
<p>Checksums:</p>
<p>MD5(ruby-1.8.7-p299.tar.gz)= 43533980ee0ea57381040d4135cf9677<br />
SHA256(ruby-1.8.7-p299.tar.gz)= 32c99c8e3d0a0190942055b8239f1573677a02de2645d81539617011f3a5427b<br />
SIZE(ruby-1.8.7-p299.tar.gz)= 4867600</p>
<p>MD5(ruby-1.8.7-p299.tar.bz2)= 244439a87d75ab24170a9c2b451ce351<br />
SHA256(ruby-1.8.7-p299.tar.bz2)= 3d8a1e4204f1fb69c9e9ffd637c7f7661a062fc2246c559f25fda5312cfd65d8<br />
SIZE(ruby-1.8.7-p299.tar.bz2)= 4183359</p>
<p>MD5(ruby-1.8.7-p299.zip)= b548dbdfc036979bdcb5e0962c87c9eb<br />
SHA256(ruby-1.8.7-p299.zip)= 30e3ed4ce977a770223f34997ea0d025c180c4664a0bd0d35ef09e48d5c89860<br />
SIZE(ruby-1.8.7-p299.zip)= 5965156</p>
<p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/06/25/ruby-1-8-7-p299-version-released/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How to deploy rails website with passenger -rails deployment with passenger</title>
		<link>http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/</link>
		<comments>http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 10:06:35 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails deployment]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=3530</guid>
		<description><![CDATA[http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/While working with PHP, I realized that deployment of a PHP application is far more easier as compared to deployment of a Ruby on Rails application. So I was wondering if there could be a way to deploy a Ruby &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/<p><a href="http://images.wordpressapi.com/passenger_preference_pane.png"><img class="alignnone size-full wp-image-3532" title="passenger_preference_pane" src="http://images.wordpressapi.com/passenger_preference_pane.png" alt="" /></a></p>
<p>While working with PHP, I realized that deployment of a PHP  application is far more easier as compared to deployment of a Ruby on  Rails application. So I was wondering if there could be a way to deploy a  Ruby on Rails application in a similar fashion, as easy as you check  out the Rails project in a directory on the server, configure a  VirtualHost in the webserver, restart the webserver and there you go,  everything should work as expected.</p>
<p>Luckily I did find a saviour,</p>
<p><strong>“Phusion Passenger” a.k.a “mod_rails” or “mod_rack”</strong></p>
<p>Here I am putting down steps to ride Rails on Passenger.</p>
<p><strong>Install Passenger</strong></p>
<p>Passenger is available as a Rubygem. As root,</p>
<p><code>gem install passenger</code></p>
<p><strong>Install Passenger module for Apache</strong></p>
<p><code>passenger-install-apache2-module</code></p>
<p>During installation it will prompt:</p>
<blockquote><p>The Apache2 module was successfully installed.</p>
<p>Please edit your Apache configuration file, and add these lines:</p>
<p><code>LoadModule passenger_module  /usr/lib64/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so<br />
PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-2.2.11<br />
PassengerRuby /usr/bin/ruby</code></p></blockquote>
<p>NOTE: Do NOT copy-paste from here. Make sure you add the lines that  passenger prompts you with.<br />
It is specific to the OS installation. Mine was a Fedora Core 10 64-bit  installation.</p>
<p>Next, it will help you to configure a VirtualHost for Apache</p>
<blockquote><p><code>&lt;VirtualHost *:80&gt;<br />
ServerName www.yourhost.com<br />
DocumentRoot /somewhere/public</code></p>
<p><code> &lt;Directory /somewhere/public&gt;<br />
AllowOverride all<br />
Options -MultiViews<br />
&lt;/Directory&gt;</code></p>
<p><code>&lt;/VirtualHost&gt;</code></p></blockquote>
<p><strong>Restart Apache:</strong></p>
<p>As root,</p>
<p><code>/sbin/service httpd restart</code></p>
<p>That&#8217;s it, we are done.<br />
Point your browser to your domain, and you should be able to see your  Ruby on Rails Application.</p>
<p>Do keep in mind that the default Rails environment while using  Passenger is “production”<br />
To access your application in “development” or any other environment add  the following line in your VirtualHost configuration:</p>
<p><code>RailsEnv development</code></p>
<p><strong>Restarting your application deployed in production  environment:</strong></p>
<p>To restart your Rails application deployed in production environment  you can restart Apache.<br />
But that&#8217;s not a good solution if you are hosting multiple applications  on the same server, or even generally, it doesn&#8217;t sound like a good idea  to restart Apache every now and then.<br />
To overcome that, you can restart your application in the following way:</p>
<p>From Rails Root Directory,</p>
<p><code>touch tmp/restart.txt</code></p>
<p>That&#8217;s it, this will restart you Rails application.</p>
<p>The best part is, Passenger is compatible with all the Rubygems and  Rails plugins.</p>
<p>So nothing should break. I personally tried running a complex Rails  application that uses Solr as the search engine along with acts_as_solr  plugin, backgroundRB server for background processes, attachment_fu for  file uploads etc, etc.</p>
<p>Everything worked like a charm.</p>
<p>For further configuration, please refer to the Passenger  documentation found <a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#_configuring_phusion_passenger" target="_blank">here</a>:</p>
<p>You can also use Passenger to serve Non-Rails Ruby web applications.  That can be a good alternative to the already prevalent <strong>mod_ruby</strong> module for Apache.<br />
If you are using Nginx as your webserver, you can use Passenger module  for Nginx.</p>
<p>There&#8217;s just one disadvantage to Passenger:</p>
<p><strong>It doesn&#8217;t work on Windows</strong>. In any case, I  personally never prefer to develop Rails (or any other) applications on  Windows <img src='http://wordpressapi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Good news for Mac users:</p>
<p><a href="http://www.google.co.in/url?sa=t&amp;source=web&amp;ct=res&amp;cd=5&amp;ved=0CBkQFjAE&amp;url=http%3A%2F%2Fwww.fngtps.com%2F2008%2F12%2Fpassenger-preference-pane-v1-2&amp;rct=j&amp;q=rails+passenger+pref+pane&amp;ei=nTmrS9PcNpXk7AO_huGzDw&amp;usg=AFQjCNHP1ra5YDrzjpu7eNE74O9dlh9Rqw" target="_blank">fingertips</a> has come up with an OS X preference pane  for Phusion Passenger (a.k.a. mod_rails) that makes it a cinch to  deploy Rails applications using Passenger on the Mac. It can be as  simple as dragging a Rails application folder onto the preference pane!  This is absolutely ideal for quick and easy Rails development on OS X.</p>
<p>You can download the <strong>Passenger Preference Pane</strong> <a href="http://go2.wordpress.com/?id=725X1342&amp;site=adhirajrankhambe.wordpress.com&amp;url=http%3A%2F%2Fwww.fngtps.com%2Fpassenger-preference-pane&amp;sref=http%3A%2F%2Fadhirajrankhambe.wordpress.com%2F2010%2F03%2F20%2Friding-rails-the-php-way%2F" target="_blank">here</a></p>
<p><strong>References:</strong></p>
<p><a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html" target="_blank">http://www.modrails.com/documentation/Users%20guide%20Apache.html</a></p>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/" title="passenger VirtualHost overlap on port 80 the first has precedence">passenger VirtualHost overlap on port 80 the first has precedence</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/06/23/deploy-rails-website-passenger-rails-deployment-passenger/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Ruby 1.9.1 is came with performance improvement of 63%</title>
		<link>http://wordpressapi.com/2010/02/27/ruby-1-9-1-performance-improvement-63/</link>
		<comments>http://wordpressapi.com/2010/02/27/ruby-1-9-1-performance-improvement-63/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 18:34:32 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=1624</guid>
		<description><![CDATA[http://wordpressapi.com/2010/02/27/ruby-1-9-1-performance-improvement-63/Ruby is very powerful object oriented language. Working with pure Ruby is really fun and interesting to me. I am real fan of Ruby language. I am working Ruby on Rails for around last four years. There is always I &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/02/27/ruby-1-9-1-performance-improvement-63/<p>Ruby is very powerful object oriented language. Working with pure Ruby is really fun and interesting to me. I am real fan of Ruby language.</p>
<p>I am working Ruby on Rails for around last four years. There is always I am thinking and all ROR developers are thinking about performance of application.</p>
<p>We always compare Ruby on Rails with PHP, Java, Python, dot net. We came to know that where we are lacking in ROR. Just one issue performance and memory issue.</p>
<p>When we got news about Ruby 1.9 is comming with performance improvement of 63%. Yes, It is not a joke. This is really great news for every ROR developers. Ruby 1.9 and Rails 3.0 is the future of internet.</p>
<p>Now I will talk about Ruby Software engineer who developed and worked on the Ruby 1.9.</p>
<p><a href="http://images.wordpressapi.com/Masahiro-Kanai.jpg"><img class="alignleft size-medium wp-image-1625" style="margin: 5px" title="Masahiro Kanai" src="http://images.wordpressapi.com/Masahiro-Kanai-300x300.jpg" alt="" width="300" height="300" /></a><strong>Masahiro Kanai, </strong>who improved the performance of several methods in Ruby 1.9. He is the age of high school, just 17.</p>
<p>This year, Ruby 1.9 by the Fibonacci sequence of operations (multiple-precision addition) is,<br />
Ruby 1.8 is slower than I realized Mr. Kanai is a challenge to freedom of choice camp Ruby faster.</p>
<p>In front of all the participants had a similar problem occurring, Ruby of type String, Array types (structures that may have an embedded data structure type object itself) and some of the faster method, attention collection. Oden&#8217;s is known to be well-covered tongue teachers. Ruby continued even after the camp&#8217;s efforts to speed up to approximately some methods to remove the macro in a constant loop of 63 percent to about 8 percent of success in speeding. This patch has been adopted by the community of developers Ruby, Ruby has been incorporated into the trunk (October 5, 2009).</p>
<p>many professional engineers and developers, with patience to hold out that the problem is resolved, probably as a programmer in one or two talents.</p>
<p>Ketai that builds skills and career tips for the professional engineer. Interviewers are already familiar with this series, the Mr. Ikuo Takeuchi, Professor Department of Creative Informatics, Graduate School of Information Science and Engineering, University of Tokyo. This time, who undertook the voluntary and discover if training for a talented programmer.</p>
<p>His mentor was Koichi Sasada (ko1). The performances of the methods he worked have been bumped up 63% in maximum, 8% in average. His patches were applied to Ruby trunk in Oct. 5 this year.</p>
<h3>What he did for Ruby Performance tuning?</h3>
<p><a href="http://images.wordpressapi.com/Masahiro-Kanai2.jpg"><img class="alignleft size-medium wp-image-1626" style="margin: 5px" title="Masahiro Kanai2" src="http://images.wordpressapi.com/Masahiro-Kanai2-225x300.jpg" alt="" width="225" height="300" /></a>He took unnecessary macro references out from a loop. Masahiro spotted macros below in array.c, string.c, and struct.c were referred every time Ruby checked whether data was hold in a structure or not. Even though data were constants, Ruby saw the macros to judge data’s presence in every loop.</p>
<p>What I say now more&#8230; I am really happy and I can say this is the biggest news of 2010 in IT world.</p>
<p>One thing I want to mention here about Ruby on Rails. This thing is in mind of all ROR developers.</p>
<p>&#8220;Thank God, No need to look Jruby&#8221;</p>
<div id="_mcePaste" style="overflow: hidden;width: 1px;height: 1px">He took unnecessary macro references out from a loop. Masahiro spotted macros below in array.c, string.c, and struct.c were referred every time Ruby checked whether data was hold in a structure or not. Even though data were constants, Ruby saw the macros to judge data’s presence in every loop.</div>
<p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/02/27/ruby-1-9-1-performance-improvement-63/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails 3.0 released with new features</title>
		<link>http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/</link>
		<comments>http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 18:07:51 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=1620</guid>
		<description><![CDATA[http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/I am working on Ruby on Rails for past three and half year. It is really great to working with Ruby on Rails. Because working on Ruby on Rails is a really great feeling daily inventing new things, trying new &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/<p><a href="http://images.wordpressapi.com/ruby-on-rails-3.0.png"><img class="alignleft size-medium wp-image-1621" title="ruby-on-rails-3.0" src="http://images.wordpressapi.com/ruby-on-rails-3.0-300x212.png" alt="" width="300" height="212" /></a>I am working on Ruby on Rails for past three and half year. It is really great to working with Ruby on Rails. Because working on Ruby on Rails is a really great feeling daily inventing new things, trying new things and contributing to ROR community. Discussing new things with ROR developers is really great.</p>
<p>On 5th Feb we got news about release of Rails 3.0 beta. We all developers are really waiting for that day. We checked the new version of Rails but what is more interesting.</p>
<p>The interesting part is what is new in Rails 3.0. So many developers contributed in Rails 3.0. They really worked and planned so hard.</p>
<p>Here I am making list what Rails 3.0  has, means new features:</p>
<ul>
<li>Brand new router with an emphasis on RESTful declarations</li>
<li>New Action Mailer API modelled after Action Controller (now without the agonizing pain of sending multipart messages!)</li>
<li>New Active Record chainable query language built on top of relational algebra</li>
<li>Unobtrusive JavaScript helpers with drivers for Prototype, jQuery, and more coming (end of inline JS)</li>
<li>Explicit dependency management with Bundler</li>
</ul>
<p>If you want to use the Rails 3.0 then you should install first following gems.</p>
<pre class="brush: ruby; title: ; notranslate">
#gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
#gem install rails --pre
</pre>
<p>Or you can use following command to install whole Rails 3.0 with dependencies</p>
<pre class="brush: ruby; title: ; notranslate">
gem uninstall rubygems-update
gem update --system
#gem install rails3b
</pre>
<p><strong>Important Note: </strong>Rails 3 requires Ruby 1.8.7+ , you should install latest Ruby version. You can download latest Ruby version from here.</p>
<p><a href="http://www.ruby-lang.org/en/downloads/" target="_blank">Ruby 1.9.1</a></p>
<p>Here I am giving the list of gems and plugins which are compilable of Rails 3.0. you should check the following URL:</p>
<p><a href="http://wiki.rubyonrails.org/rails/version3/plugins_and_gems">http://wiki.rubyonrails.org/rails/version3/plugins_and_gems</a></p>
<p>Now I am started working on Rails 3.0 and I am searching for the issues with Rails 3.0 because Rails 3.0 is in Beta so all ROR developer need to come up with issues of Rails 3.0 and try to fix that or submit that issue to community.</p>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/" title="ruby on rails wallpaper">ruby on rails wallpaper</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/02/27/ruby-rails-3-0-released-features/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Rails 3 beta by February</title>
		<link>http://wordpressapi.com/2010/02/02/rails-3-beta-february/</link>
		<comments>http://wordpressapi.com/2010/02/02/rails-3-beta-february/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 09:43:23 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://images.wordpressapi.com/?p=735</guid>
		<description><![CDATA[http://wordpressapi.com/2010/02/02/rails-3-beta-february/Ruby on Rails 3, an upgrade to the popular Web development framework that merges Rails with the alternative Merb framework, is due to be offered as a beta release by the end of this month. According to David Heinemeier Hansson, &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2010/02/02/rails-3-beta-february/<p style="margin-bottom: 0in">Ruby on Rails 3, an upgrade to the popular Web development framework that merges Rails with the alternative Merb framework, is due to be offered as a beta release by the end of this month.</p>
<p style="margin-bottom: 0in"><a href="http://images.wordpressapi.com/ruby_on_rails_logo.jpg"><img class="alignnone size-thumbnail wp-image-736" title="ruby_on_rails_logo" src="http://images.wordpressapi.com/ruby_on_rails_logo-150x150.jpg" alt="ruby_on_rails_logo" width="150" height="150" /></a></p>
<p style="margin-bottom: 0in">According to David Heinemeier Hansson, the founder of the Ruby based web development framework, although a beta of Rails 3 is expected by the end of this month the release may slip into February. Hansson gave the estimated release timing in an article on InfoWorld. If all goes to plan Rails 3 is expected to arrive in the first quarter of this year. Rails 3 is a major reworking of the framework which sees ideas from the alternative Merb framework being integrated in a development process which began in December 2008.</p>
<p style="margin-bottom: 0in">
<p style="margin-bottom: 0in">Source Articles</p>
<p style="margin-bottom: 0in">http://www.engineyard.com/blog/2009/my-five-favorite-things-about-rails-3/</p>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2010/02/02/rails-3-beta-february/" title="ruby on rails 3">ruby on rails 3</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2010/02/02/rails-3-beta-february/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to host multiple rails site on Nginx</title>
		<link>http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/</link>
		<comments>http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 07:28:18 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://purab.wordpress.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/</guid>
		<description><![CDATA[http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/User following code in Nginx.conf file.. and paste into that file #vim /etc/nginx/nginx.conf Incoming search terms:multiple rails sites nginxhow to host multiple rails nginxFollow us on Twitter WordPress API]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/<p>User following code in Nginx.conf file.. and paste into that file<br />
#vim /etc/nginx/nginx.conf</p>
<pre class="brush: ruby; title: ; notranslate">

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;
access_log  /var/log/nginx/access.log  main;
sendfile        on;

upstream mongrel_cluster_example1 {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}

upstream mongrel_cluster_example2 {
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;

server {
listen       80;
server_name  example1.com example2.net;
client_max_body_size 120M;

set $myroot /var/www/html;
if ($host ~* example1\.com$) {
set $myroot /home/example1/public;
}

if ($host ~* example2\.net$) {
set $myroot /home/example2/public;
}

root $myroot;

location ~* ^/(images|stylesheets|javascripts).+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$
{
root $myroot;
}

location / {

if ($host ~* example1\.com$) {
proxy_pass      http://mongrel_cluster_example1;
} #if check for domain qa.teenangel ends here

if ($host ~* example2\.net$) {
root /home/rail_project/myproject/public;
proxy_pass      http://mongrel_cluster_example2;

} #if check for domain ends here

}

}

}
</pre>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/" title="multiple rails sites nginx">multiple rails sites nginx</a></li><li><a href="http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/" title="how to host multiple rails nginx">how to host multiple rails nginx</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2009/11/18/how-to-host-multiple-rails-site-on-nginx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>USA State list for Rails</title>
		<link>http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/</link>
		<comments>http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 12:14:20 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://purab.wordpress.com/2009/11/17/usa-state-list-for-rails/</guid>
		<description><![CDATA[http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/Every time we need this migration script for our projects Use following command for Model generate [siwan@localhost siwan]$ ruby script/generate model UsStates exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/us_states.rb create test/unit/us_states_test.rb create test/fixtures/us_states.yml exists db/migrate create db/migrate/20091117115011_create_us_states.rb [siwan@localhost siwan]$ &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/<p>Every time we need this migration script for our projects<br />
Use following command for Model generate<br />
[siwan@localhost siwan]$ ruby script/generate model UsStates<br />
exists  app/models/<br />
exists  test/unit/<br />
exists  test/fixtures/<br />
create  app/models/us_states.rb<br />
create  test/unit/us_states_test.rb<br />
create  test/fixtures/us_states.yml<br />
exists  db/migrate<br />
create  db/migrate/20091117115011_create_us_states.rb<br />
[siwan@localhost siwan]$</p>
<p>Open the /db/migrate/20091117115011_create_us_states.rb file and paste following code:</p>
<p>class CreateUsStates  &#8216;Alabama&#8217;, :abbreviation =&gt; &#8216;AL&#8217;<br />
UsStates.create :name =&gt; &#8216;Alaska&#8217;, :abbreviation =&gt; &#8216;AK&#8217;<br />
UsStates.create :name =&gt; &#8216;Arizona&#8217;, :abbreviation =&gt; &#8216;AZ&#8217;<br />
UsStates.create :name =&gt; &#8216;Arkansas&#8217;, :abbreviation =&gt; &#8216;AR&#8217;<br />
UsStates.create :name =&gt; &#8216;California&#8217;, :abbreviation =&gt; &#8216;CA&#8217;<br />
UsStates.create :name =&gt; &#8216;Colorado&#8217;, :abbreviation =&gt; &#8216;CO&#8217;<br />
UsStates.create :name =&gt; &#8216;Connecticut&#8217;, :abbreviation =&gt; &#8216;CT&#8217;<br />
UsStates.create :name =&gt; &#8216;Delaware&#8217;, :abbreviation =&gt; &#8216;DE&#8217;<br />
UsStates.create :name =&gt; &#8216;District of Columbia&#8217;, :abbreviation =&gt; &#8216;DC&#8217;<br />
UsStates.create :name =&gt; &#8216;Florida&#8217;, :abbreviation =&gt; &#8216;FL&#8217;<br />
UsStates.create :name =&gt; &#8216;Georgia&#8217;, :abbreviation =&gt; &#8216;GA&#8217;<br />
UsStates.create :name =&gt; &#8216;Hawaii&#8217;, :abbreviation =&gt; &#8216;HI&#8217;<br />
UsStates.create :name =&gt; &#8216;Idaho&#8217;, :abbreviation =&gt; &#8216;ID&#8217;<br />
UsStates.create :name =&gt; &#8216;Illinois&#8217;, :abbreviation =&gt; &#8216;IL&#8217;<br />
UsStates.create :name =&gt; &#8216;Indiana&#8217;, :abbreviation =&gt; &#8216;IN&#8217;<br />
UsStates.create :name =&gt; &#8216;Iowa&#8217;, :abbreviation =&gt; &#8216;IA&#8217;<br />
UsStates.create :name =&gt; &#8216;Kansas&#8217;, :abbreviation =&gt; &#8216;KS&#8217;<br />
UsStates.create :name =&gt; &#8216;Kentucky&#8217;, :abbreviation =&gt; &#8216;KY&#8217;<br />
UsStates.create :name =&gt; &#8216;Louisiana&#8217;, :abbreviation =&gt; &#8216;LA&#8217;<br />
UsStates.create :name =&gt; &#8216;Maine&#8217;, :abbreviation =&gt; &#8216;ME&#8217;<br />
UsStates.create :name =&gt; &#8216;Maryland&#8217;, :abbreviation =&gt; &#8216;MD&#8217;<br />
UsStates.create :name =&gt; &#8216;Massachutsetts&#8217;, :abbreviation =&gt; &#8216;MA&#8217;<br />
UsStates.create :name =&gt; &#8216;Michigan&#8217;, :abbreviation =&gt; &#8216;MI&#8217;<br />
UsStates.create :name =&gt; &#8216;Minnesota&#8217;, :abbreviation =&gt; &#8216;MN&#8217;<br />
UsStates.create :name =&gt; &#8216;Mississippi&#8217;, :abbreviation =&gt; &#8216;MS&#8217;<br />
UsStates.create :name =&gt; &#8216;Missouri&#8217;, :abbreviation =&gt; &#8216;MO&#8217;<br />
UsStates.create :name =&gt; &#8216;Montana&#8217;, :abbreviation =&gt; &#8216;MT&#8217;<br />
UsStates.create :name =&gt; &#8216;Nebraska&#8217;, :abbreviation =&gt; &#8216;NE&#8217;<br />
UsStates.create :name =&gt; &#8216;Nevada&#8217;, :abbreviation =&gt; &#8216;NV&#8217;<br />
UsStates.create :name =&gt; &#8216;New Hampshire&#8217;, :abbreviation =&gt; &#8216;NH&#8217;<br />
UsStates.create :name =&gt; &#8216;New Jersey&#8217;, :abbreviation =&gt; &#8216;NJ&#8217;<br />
UsStates.create :name =&gt; &#8216;New Mexico&#8217;, :abbreviation =&gt; &#8216;NM&#8217;<br />
UsStates.create :name =&gt; &#8216;New York&#8217;, :abbreviation =&gt; &#8216;NY&#8217;<br />
UsStates.create :name =&gt; &#8216;North Carolina&#8217;, :abbreviation =&gt; &#8216;NC&#8217;<br />
UsStates.create :name =&gt; &#8216;North Dakota&#8217;, :abbreviation =&gt; &#8216;ND&#8217;<br />
UsStates.create :name =&gt; &#8216;Ohio&#8217;, :abbreviation =&gt; &#8216;OH&#8217;<br />
UsStates.create :name =&gt; &#8216;Oklahoma&#8217;, :abbreviation =&gt; &#8216;OK&#8217;<br />
UsStates.create :name =&gt; &#8216;Oregon&#8217;, :abbreviation =&gt; &#8216;OR&#8217;<br />
UsStates.create :name =&gt; &#8216;Pennsylvania&#8217;, :abbreviation =&gt; &#8216;PA&#8217;<br />
UsStates.create :name =&gt; &#8216;Rhode Island&#8217;, :abbreviation =&gt; &#8216;RI&#8217;<br />
UsStates.create :name =&gt; &#8216;South Carolina&#8217;, :abbreviation =&gt; &#8216;SC&#8217;<br />
UsStates.create :name =&gt; &#8216;South Dakota&#8217;, :abbreviation =&gt; &#8216;SD&#8217;<br />
UsStates.create :name =&gt; &#8216;Tennessee&#8217;, :abbreviation =&gt; &#8216;TN&#8217;<br />
UsStates.create :name =&gt; &#8216;Texas&#8217;, :abbreviation =&gt; &#8216;TX&#8217;<br />
UsStates.create :name =&gt; &#8216;Utah&#8217;, :abbreviation =&gt; &#8216;UT&#8217;<br />
UsStates.create :name =&gt; &#8216;Vermont&#8217;, :abbreviation =&gt; &#8216;VT&#8217;<br />
UsStates.create :name =&gt; &#8216;Virginia&#8217;, :abbreviation =&gt; &#8216;VA&#8217;<br />
UsStates.create :name =&gt; &#8216;Washington&#8217;, :abbreviation =&gt; &#8216;WA&#8217;<br />
UsStates.create :name =&gt; &#8216;West Virginia&#8217;, :abbreviation =&gt; &#8216;WV&#8217;<br />
UsStates.create :name =&gt; &#8216;Wisconsin&#8217;, :abbreviation =&gt; &#8216;WI&#8217;<br />
UsStates.create :name =&gt; &#8216;Wyoming&#8217;, :abbreviation =&gt; &#8216;WY&#8217;</p>
<p>end</p>
<p>def self.down<br />
drop_table :us_states<br />
end<br />
end</p>
<p>Goodlunk, This code will save your problem of fetching USA state names and abbreviations as per id</p>
<p>Check my controller code&#8230;Just put in your controller</p>
<p>@us_states = USStates.find(:all)</p>
<p>&lt;% form_for :customer, @customer, :url =&gt; { :action =&gt; &#8220;new_application&#8221; } do |f| %&gt;<br />
&lt;%= f.select :state_id,  @us_states.collect {|state| [ state.abbreviation, state.id ] } %&gt;<br />
&lt;% end %&gt;</p>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/" title="rails 3 state name abbreviations">rails 3 state name abbreviations</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2009/11/17/usa-state-list-for-rails/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Issue with installing the mysql gem: solved, how to install mysql gem without issue</title>
		<link>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/</link>
		<comments>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 09:50:35 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[MySql]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://purab.wordpress.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/</guid>
		<description><![CDATA[http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/When tried to install mysql gem I got following error [root@localhost siwan]# sudo gem install mysql Building native extensions. This could take a while&#8230; ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for mysql_ssl_set()&#8230; &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/<p>When tried to install mysql gem I got following error<br />
[root@localhost siwan]# sudo gem install mysql<br />
Building native extensions.  This could take a while&#8230;<br />
ERROR:  Error installing mysql:<br />
	ERROR: Failed to build gem native extension.</p>
<p>/usr/bin/ruby extconf.rb<br />
checking for mysql_ssl_set()&#8230; yes<br />
checking for rb_str_set_len()&#8230; no<br />
checking for rb_thread_start_timer()&#8230; yes<br />
checking for mysql.h&#8230; no<br />
checking for mysql/mysql.h&#8230; no<br />
*** extconf.rb failed ***<br />
Could not create Makefile due to some reason, probably lack of<br />
necessary libraries and/or headers.  Check the mkmf.log file for more<br />
details.  You may need configuration options.</p>
<p>Provided configuration options:<br />
	&#8211;with-opt-dir<br />
	&#8211;without-opt-dir<br />
	&#8211;with-opt-include<br />
	&#8211;without-opt-include=${opt-dir}/include<br />
	&#8211;with-opt-lib<br />
	&#8211;without-opt-lib=${opt-dir}/lib<br />
	&#8211;with-make-prog<br />
	&#8211;without-make-prog<br />
	&#8211;srcdir=.<br />
	&#8211;curdir<br />
	&#8211;ruby=/usr/bin/ruby<br />
	&#8211;with-mysql-config<br />
	&#8211;without-mysql-config</p>
<p>Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.<br />
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out</p>
<p>To find the mysql path on machine used following command<br />
[root@localhost siwan]# which mysql<br />
/usr/bin/mysql</p>
<p>I tried following command:<br />
[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql</p>
<p>I Got the same error</p>
<p>[root@localhost siwan]# sudo gem install mysql — –with-mysql-dir=/usr/bin/mysql<br />
Building native extensions.  This could take a while&#8230;<br />
ERROR:  Error installing mysql:<br />
	ERROR: Failed to build gem native extension.</p>
<p>/usr/bin/ruby extconf.rb<br />
checking for mysql_ssl_set()&#8230; yes<br />
checking for rb_str_set_len()&#8230; no<br />
checking for rb_thread_start_timer()&#8230; yes<br />
checking for mysql.h&#8230; no<br />
checking for mysql/mysql.h&#8230; no<br />
*** extconf.rb failed ***<br />
Could not create Makefile due to some reason, probably lack of<br />
necessary libraries and/or headers.  Check the mkmf.log file for more<br />
details.  You may need configuration options.</p>
<p>Provided configuration options:<br />
	&#8211;with-opt-dir<br />
	&#8211;without-opt-dir<br />
	&#8211;with-opt-include<br />
	&#8211;without-opt-include=${opt-dir}/include<br />
	&#8211;with-opt-lib<br />
	&#8211;without-opt-lib=${opt-dir}/lib<br />
	&#8211;with-make-prog<br />
	&#8211;without-make-prog<br />
	&#8211;srcdir=.<br />
	&#8211;curdir<br />
	&#8211;ruby=/usr/bin/ruby<br />
	&#8211;with-mysql-config<br />
	&#8211;without-mysql-config</p>
<p>Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.<br />
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out<br />
ERROR:  could not find gem — locally or in a repository<br />
ERROR:  could not find gem –with-mysql-dir=/usr/bin/mysql locally or in a repository</p>
<p>Then I checked the mysql-devel<br />
[root@localhost siwan]# yum list mysql-devel<br />
Loaded plugins: refresh-packagekit<br />
Available Packages<br />
mysql-devel.i586                                              5.1.37-1.fc11                                               updates</p>
<p>Then I Installed the mysql-devel<br />
[root@localhost siwan]# yum install mysql-devel<br />
Installed:<br />
  mysql-devel.i586 0:5.1.37-1.fc11<br />
Complete!</p>
<p>Then I tried the mysql Gem installing&#8230;..I am able to install the mysql gem&#8230;<br />
[root@localhost siwan]# gem install mysql<br />
Building native extensions.  This could take a while&#8230;<br />
Successfully installed mysql-2.8.1<br />
1 gem installed<br />
Installing ri documentation for mysql-2.8.1&#8230;<br />
Installing RDoc documentation for mysql-2.8.1&#8230;<br />
[root@localhost siwan]#</p>
<p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2009/11/17/issue-with-installing-the-mysql-gem-solved-how-to-install-mysql-gem-without-issue/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>How to setup mongrel cluster setup on fedora</title>
		<link>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/</link>
		<comments>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 13:46:43 +0000</pubDate>
		<dc:creator>Wordpress API</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[mongrel_cluster]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://purab.wordpress.com/?p=293</guid>
		<description><![CDATA[http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/First install the following gems: #su #gem install mongrel #gem install mongrel_cluster #cd project_name #mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /home/siwan/project_name -a 127.0.0.1 &#8212;-prefix /project_name # mongrel_rails cluster::start You are able to start your applicaton at http://127.0.0.1:3000, &#8230; Continue reading &#8594;]]></description>
			<content:encoded><![CDATA[http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/<p>First install the following gems:<br />
#su<br />
#gem install mongrel<br />
#gem install mongrel_cluster<br />
#cd project_name<br />
#mongrel_rails cluster::configure -e production -p 3000 -N 3 -c /home/siwan/project_name -a 127.0.0.1 &#8212;-prefix /project_name<br />
# mongrel_rails cluster::start</p>
<p>You are able to start your applicaton at http://127.0.0.1:3000, http://127.0.0.1:3001 and http://127.0.0.1:3002</p>
<p>for all the cluster<br />
# mongrel_rails cluster::stop</p>
<p>Advanced prepairation for production realeaze<br />
$ mkdir /etc/mongrel_cluster</p>
<p>#vim /etc/mongrel_cluster/project_name.yml<br />
copy and paste following text;<br />
user: project_name<br />
cwd: //home/siwan/project_name<br />
log_file: /home/siwan/project_name/mongrel.log<br />
port: &#8220;3000&#8243;<br />
environment: production<br />
group: dev<br />
address: localhost<br />
pid_file: /home/siwan/project_name/tmp/pids/mongrel.pid<br />
servers: 3</p>
<p>or you can run the following command</p>
<p>or copy and paste the content from config/mongrel_cluster.yml file to /etc/mongrel_cluster/project_name.yml</p>
<p># ln -s /home/siwan/project_name/config/mongrel_cluster.yml /etc/mongrel_cluster/project_name.yml</p>
<p>Then open your httpd.conf file for apache configration:</p>
<p>&lt;Proxy balancer://project_name&gt;<br />
BalancerMember http://127.0.0.1:3000<br />
BalancerMember http://127.0.0.1:3001<br />
BalancerMember http://127.0.0.1:3002<br />
&lt;/Proxy&gt;</p>
<p>&lt;VirtualHost *:80&gt;<br />
ProxyPreserveHost On<br />
# Avoid open you server to proxying<br />
ProxyRequests Off<br />
# Options +FollowSymLinks<br />
RewriteEngine On</p>
<p>RewriteRule ^/(images|stylesheet|javascript|html)/?(.*) /home/siwan/project_name/public/$0 [L]<br />
ServerAdmin siwan@yahoo.co.in<br />
DocumentRoot /home/project_name/<br />
ServerName example.com<br />
RewriteRule  ^/(.*)$  balancer://project_name%{REQUEST_URI} [P,QSA,L]<br />
&lt;/VirtualHost&gt;</p>
<p>Restart the apache server<br />
#/etc/init.d/httpd restart</p>
<p>Command for restart the mongrel servers from any where<br />
# mongrel_rails cluster::restart -C /etc/mongrel_cluster/project_name.yml</p>
<h4>Incoming search terms:</h4><ul><li><a href="http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/" title="mongrel api">mongrel api</a></li></ul><p>Follow us on Twitter <a href="http://twitter.com/wordpressapi">WordPress API</a></p>]]></content:encoded>
			<wfw:commentRss>http://wordpressapi.com/2009/11/02/how-to-setup-mongrel-cluster-setup-on-fedora/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: wordpressapi.com @ 2012-02-05 13:49:29 by W3 Total Cache -->
