<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
 
 <title type="text">CODE@PRASHANTRAJAN</title>
 
 <link href="http://code.prashantrajan.com/" />
 <updated>2011-04-08T05:05:02-07:00</updated>
 <id>http://code.prashantrajan.com/</id>
 <author>
   <name>CODE@PRASHANTRAJAN</name>
   <email />
 </author>

 
 <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/codeprashantrajan" /><feedburner:info uri="codeprashantrajan" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by/3.0/" /><entry>
   <title>Devise - Verifying a password</title>
   <link href="http://feedproxy.google.com/~r/codeprashantrajan/~3/77SGzasEavA/devise-verifying-a-password.html" />
   <updated>2011-01-23T00:00:00-08:00</updated>
   <id>http://code.prashantrajan.com/2011/01/devise-verifying-a-password</id>
   <content type="html">&lt;h1&gt;Devise - Verifying a password&lt;/h1&gt;

&lt;p&gt;&lt;a title="Devise Gem" href="https://github.com/plataformatec/devise"&gt;Devise&lt;/a&gt; is a flexible authentication system for Rails. It's constantly being updated and has pretty good documentation. It's quickly becoming the de-facto authentication solution in the Ruby on Rails world.&lt;/p&gt;

&lt;p&gt;These Railscasts will help get you started if you're new to Devise:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://railscasts.com/episodes/209-introducing-devise"&gt;#209 - Introducing Devise&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://railscasts.com/episodes/210-customizing-devise"&gt;#210 - Customizing Devise&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;There will come a time when you'll need to validate a plain text password outside of the Devise standard flow. This is how you can go about that assuming you have a similar setup:&lt;/p&gt;

&lt;script src="https://gist.github.com/792070.js?file=user.rb"&gt;&lt;/script&gt;


&lt;p&gt;The method &lt;strong&gt;#valid_password?&lt;/strong&gt; will be available in your Devise based models which you can pass a plain text password and receive a &lt;strong&gt;true/false&lt;/strong&gt; return value.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/codeprashantrajan/~4/77SGzasEavA" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://code.prashantrajan.com/2011/01/devise-verifying-a-password.html</feedburner:origLink></entry>
 
 <entry>
   <title>RSpec 2 – Loading All Fixtures Everytime in Rails</title>
   <link href="http://feedproxy.google.com/~r/codeprashantrajan/~3/b9_gWR4-Egc/rspec-2-loading-all-fixtures-everytime-in-rails.html" />
   <updated>2010-12-04T00:00:00-08:00</updated>
   <id>http://code.prashantrajan.com/2010/12/rspec-2-loading-all-fixtures-everytime-in-rails</id>
   <content type="html">&lt;h1&gt;RSpec 2 – Loading All Fixtures Everytime in Rails&lt;/h1&gt;

&lt;p&gt;An easy way to load all the fixtures all the time is to do it in the spec_helper.rb file by adding &lt;em&gt;&lt;strong&gt;config.global_fixtures = :all&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;script src="https://gist.github.com/888181.js?file=spec_helper.rb"&gt;&lt;/script&gt;

&lt;img src="http://feeds.feedburner.com/~r/codeprashantrajan/~4/b9_gWR4-Egc" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://code.prashantrajan.com/2010/12/rspec-2-loading-all-fixtures-everytime-in-rails.html</feedburner:origLink></entry>
 
 <entry>
   <title>Apache mod_rails (Passenger) Virtual Host</title>
   <link href="http://feedproxy.google.com/~r/codeprashantrajan/~3/1-mY0inrgaM/apache-mod-rails-virtual-host.html" />
   <updated>2010-08-31T00:00:00-07:00</updated>
   <id>http://code.prashantrajan.com/2010/08/apache-mod-rails-virtual-host</id>
   <content type="html">&lt;h1&gt;Apache mod_rails (Passenger) Virtual Host&lt;/h1&gt;

&lt;p&gt;Sample Apache Virtual Host for serving Rails applications:&lt;/p&gt;

&lt;script src="https://gist.github.com/550720.js?file=site.conf"&gt;&lt;/script&gt;

&lt;img src="http://feeds.feedburner.com/~r/codeprashantrajan/~4/1-mY0inrgaM" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://code.prashantrajan.com/2010/08/apache-mod-rails-virtual-host.html</feedburner:origLink></entry>
 
 <entry>
   <title>ActiveRecord Serialization Gotcha</title>
   <link href="http://feedproxy.google.com/~r/codeprashantrajan/~3/UpXHm168J58/activerecord-serialization-gotcha.html" />
   <updated>2010-08-31T00:00:00-07:00</updated>
   <id>http://code.prashantrajan.com/2010/08/activerecord-serialization-gotcha</id>
   <content type="html">&lt;h1&gt;ActiveRecord Serialization Gotcha&lt;/h1&gt;

&lt;p&gt;Gotcha when using ActiveRecord's serialize method (Rails 2.3.8).&lt;/p&gt;

&lt;p&gt;Say you have an ActiveRecord backed Order model that looks something like this:&lt;/p&gt;

&lt;script src="https://gist.github.com/888166.js?file=order.rb"&gt;&lt;/script&gt;


&lt;p&gt;Where PricingParams is a non-ActiveRecord based model whose attributes include other ActiveRecord objects:&lt;/p&gt;

&lt;script src="https://gist.github.com/888169.js?file=pricing_params.rb"&gt;&lt;/script&gt;


&lt;p&gt;In order for Rails to properly unserialize the Order#pricing_params contents, you'll need to manually require the necessary ActiveRecord objects in the PricingParams class (as shown with the require statements in the snippet above). If you don't do this, then Order#pricing_params won't know how to respond to any of the Product or Price methods.&lt;/p&gt;

&lt;p&gt;Took me a while to figure this out so hopefully this will save someone else some time.&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/codeprashantrajan/~4/UpXHm168J58" height="1" width="1"/&gt;</content>
 <feedburner:origLink>http://code.prashantrajan.com/2010/08/activerecord-serialization-gotcha.html</feedburner:origLink></entry>
 
 
</feed>

