<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1211736010173676186</id><updated>2011-07-30T22:41:29.483-07:00</updated><category term='undefined method `each&apos; for false:FalseClass'/><category term='days difference in rails'/><category term='ruby on rails'/><category term='deep_symbolize_keys'/><category term='date difference in rails'/><category term='passing parameter in routes'/><category term='rails'/><category term='localization'/><category term='rails route'/><category term='redirect_to :back'/><category term='rails 3.0'/><category term='authlogic'/><category term='redirect back'/><title type='text'>Rails house</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1211736010173676186.post-1771105173485888475</id><published>2010-06-27T23:58:00.000-07:00</published><updated>2010-06-28T00:01:26.479-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='localization'/><category scheme='http://www.blogger.com/atom/ns#' term='deep_symbolize_keys'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 3.0'/><title type='text'>undefined method `deep_symbolize_keys' for</title><content type='html'>check you locale files if the parent locale is there.&lt;br /&gt;&lt;br /&gt;for example in en.yml file, it may have en: as fist active text&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1211736010173676186-1771105173485888475?l=railscash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/1771105173485888475/comments/default' title='মন্তব্যগুলি পোস্ট করুন'/><link rel='replies' type='text/html' href='http://railscash.blogspot.com/2010/06/undefined-method-deepsymbolizekeys-for.html#comment-form' title='0টি মন্তব্য'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/1771105173485888475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/1771105173485888475'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/2010/06/undefined-method-deepsymbolizekeys-for.html' title='undefined method `deep_symbolize_keys&apos; for'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1211736010173676186.post-3635814951467410628</id><published>2010-06-27T23:49:00.000-07:00</published><updated>2010-06-27T23:57:52.281-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='authlogic'/><category scheme='http://www.blogger.com/atom/ns#' term='undefined method `each&apos; for false:FalseClass'/><category scheme='http://www.blogger.com/atom/ns#' term='rails 3.0'/><title type='text'>undefined method `each' for false:FalseClass</title><content type='html'>if you get this type message and cant find the error location then there could be some reasons behind it.&lt;br /&gt;This is one of them.&lt;br /&gt;&lt;br /&gt;just review the locale files you have used, if it meets the yml syntax.&lt;br /&gt;Or&lt;br /&gt;take backup of original local files&lt;br /&gt;create new rails app.&lt;br /&gt;copy en.yml to yours application's locales dir.&lt;br /&gt;&lt;br /&gt;if application runs then there must me errors in yml file. try to fix it.&lt;br /&gt;&lt;br /&gt;cheers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1211736010173676186-3635814951467410628?l=railscash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/3635814951467410628/comments/default' title='মন্তব্যগুলি পোস্ট করুন'/><link rel='replies' type='text/html' href='http://railscash.blogspot.com/2010/06/undefined-method-each-for.html#comment-form' title='0টি মন্তব্য'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/3635814951467410628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/3635814951467410628'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/2010/06/undefined-method-each-for.html' title='undefined method `each&apos; for false:FalseClass'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1211736010173676186.post-5431898914744611881</id><published>2009-12-28T02:21:00.000-08:00</published><updated>2009-12-28T03:22:53.948-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='redirect back'/><category scheme='http://www.blogger.com/atom/ns#' term='redirect_to :back'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><title type='text'>redirect back in rails</title><content type='html'>The back button is most commonly used button in web browser.&lt;br /&gt;but it becomes pain to developers very often specially when forms are submitted (in post method)&lt;br /&gt;&lt;br /&gt;A back button in web page is useful rather using the browser back button:&lt;br /&gt;&lt;br /&gt;here is a simple tip for using back button in web page:&lt;br /&gt;&lt;br /&gt;#in appplication_controller.rb (for earlier version application.rb )&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;before_filter :store_location&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;private:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;def store_location&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  session[:return_to] = request.env['HTTP_REFERER']&lt;br /&gt;session[:previous_request_method] = request.method &lt;/span&gt;#to avoid redirect to post url&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#in application_helper.rb&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;def link_to_back_or_default_path(*args)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    text = args.first || 'Back'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    default_path = args.second || default_path&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   &lt;/span&gt; #default_path can be root_path or any other fixed path&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    html_options = args.third&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    if session[:previous_request_method].to_s =='post' || session[:return_to] == ''&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;      redirect_path = default_path&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;      redirect_path = session[:return_to]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    end&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;    link_to(text, redirect_path, html_options)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;#in view &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;%=link_to_back_or_default_path('back', 'http://boo.com', :class=&gt;'foo, :id=&gt;'bar')%&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;or simply&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;%=link_to_back_or_default_path%&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Share your thoughts&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1211736010173676186-5431898914744611881?l=railscash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/5431898914744611881/comments/default' title='মন্তব্যগুলি পোস্ট করুন'/><link rel='replies' type='text/html' href='http://railscash.blogspot.com/2009/12/rails-redirect-back.html#comment-form' title='0টি মন্তব্য'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/5431898914744611881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/5431898914744611881'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/2009/12/rails-redirect-back.html' title='redirect back in rails'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1211736010173676186.post-1389357405293643541</id><published>2009-12-28T00:34:00.001-08:00</published><updated>2009-12-28T03:18:14.936-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='passing parameter in routes'/><category scheme='http://www.blogger.com/atom/ns#' term='rails route'/><title type='text'>rails passing parameters in routes generated path</title><content type='html'>In Rails for a complete, controlled and structured routing we should specify all paths in routes.&lt;br /&gt;sometimes we may need to send some parameters in route&lt;br /&gt;&lt;br /&gt;for example we need a route for saved listing for a user.&lt;br /&gt;&lt;br /&gt;we can achieve this by the following in routes.rb&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;map.resources :users, :collection =&gt;{:saved_listing =&gt; :get, :other_action =&gt;:post}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the path might be generated by:&lt;br /&gt;&lt;br /&gt;Option 1:&lt;br /&gt;saved_listing_users_path(user)//user is an object&lt;br /&gt;&lt;br /&gt;Option 2://passing only id&lt;br /&gt;saved_listing_users_path(:id=&gt;user_id)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If we need to add others parameters in url then,&lt;br /&gt;&lt;br /&gt;Option 3://passing  id with other params&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;saved_listing_users_path(:id=&gt;user_id, :lan=&gt;'en', :foo =&gt;'bar')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Option 4://passing only hash&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;param_hash = {:id=&gt;user_id,  :lan=&gt;'en',  :foo =&gt;'bar'}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   saved_listing_users_path(param_hash)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometime we may need to pass all parameters to url,  then the following will not works:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;saved_listing_users_path(params)&lt;/span&gt;&lt;br /&gt;because though params is a hash but it includes :controller, :action in key list.&lt;br /&gt;&lt;br /&gt;so we need the followings:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;param_hash = params.clone &lt;/span&gt;//take params clone not params to avoid reference problem&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;param_hash.delete_if {|key, value| ['controller', 'action'].include?(key) }&lt;/span&gt;&lt;br /&gt;//remove controler and action from params&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;saved_listing_users_path(param_hash)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;we can use mix type in parameters like some key,value pair and a hash.&lt;br /&gt;then we have to use :params key for the hash in parameter list&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;saved_listing_users_path(:id=&gt;34, :params=&gt;param_hash)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I think this will be helpfull a little.&lt;br /&gt;and you all are welcome to share your thoughts&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1211736010173676186-1389357405293643541?l=railscash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/1389357405293643541/comments/default' title='মন্তব্যগুলি পোস্ট করুন'/><link rel='replies' type='text/html' href='http://railscash.blogspot.com/2009/12/rails-passing-parameters-in-routes.html#comment-form' title='0টি মন্তব্য'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/1389357405293643541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/1389357405293643541'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/2009/12/rails-passing-parameters-in-routes.html' title='rails passing parameters in routes generated path'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1211736010173676186.post-5403576467503281208</id><published>2009-10-13T22:37:00.000-07:00</published><updated>2009-10-13T23:05:53.977-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='days difference in rails'/><category scheme='http://www.blogger.com/atom/ns#' term='date difference in rails'/><title type='text'>Date difference in rails</title><content type='html'>when we are working on rails, sometimes we may require this&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Say, we have User model and we need to find out how many days  he registered.&lt;br /&gt;You can have lots of ways to find that as you are on Rails(some might have some problem though)&lt;br /&gt;&lt;br /&gt;here is another way(I think it will work smartly )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;user = User.find(#id)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;Registered &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-style: italic;"&gt;(user.created_at.to_date - Date.today).to_i&lt;/span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;days ago &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Similarly for days difference between two days :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;&lt;span style="font-weight: bold; font-style: italic;font-size:130%;" &gt;(user1.created_at.to_date - user2.created_at.to_date).to_i&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Cheers!&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1211736010173676186-5403576467503281208?l=railscash.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://railscash.blogspot.com/feeds/5403576467503281208/comments/default' title='মন্তব্যগুলি পোস্ট করুন'/><link rel='replies' type='text/html' href='http://railscash.blogspot.com/2009/10/date-difference-in-rails.html#comment-form' title='1টি মন্তব্য'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/5403576467503281208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1211736010173676186/posts/default/5403576467503281208'/><link rel='alternate' type='text/html' href='http://railscash.blogspot.com/2009/10/date-difference-in-rails.html' title='Date difference in rails'/><author><name>Rails House</name><uri>http://www.blogger.com/profile/05612336520929379886</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
