Notes posted by Manfred
RSS feed Manfred -  
    December 27, 2012 - (>= v2.3.8)
 Manfred -  
    December 27, 2012 - (>= v2.3.8)
    
  Example
NOTE: you pass all the keys and values in one long list:
fruit = ActiveSupport::OrderedHash[ 'apple', 'Apple', 'banana', 'Banana', 'kiwi', 'Kiwi fruit', ] fruit.keys => ["apple", "banana", "kiwi"]
 Manfred -  
    October 26, 2011
 Manfred -  
    October 26, 2011 
    
  Adding to the URL
If you want to use polymorphic routing for your object but you also need to specify other stuff like an anchor, you can explicitly generate the polymorphic url with extra options:
form_for @candidate, :url => polymorphic_path(@candidate, :anchor => 'signup')
 Manfred -  
    August  6, 2009
 Manfred -  
    August  6, 2009 
    
  *Described above
The documentation is referring to the module documentation: ActionController::Cookies
 Manfred -  
    June 22, 2009
 Manfred -  
    June 22, 2009 
    
  Optional local assigns
When you have a partial with optional local assigns, for instance:
<%= render :partial => 'articles/preview' %> <%= render :partial => 'articles/preview', :locals => { :show_call_out => true } %>
And you don’t want the partial to break when the local isn’t assigned, you can reference it through the local_assigns local variable instead of through the template binding:
<% if local_assigns[:show_call_out] %> <em><%= format @article.call_out %></em> <% end %>
 Manfred -  
    June 11, 2009
 Manfred -  
    June 11, 2009 
    
  Not really helpful
When you’re trying to construct a specialized path name for a partial based on a record type you’re probably better off writing your own helper.
def topic_partial_path(topic) ['admin', topic.class.table_name, "#{topic.class.table_name.singularize}_as_topic"].join('/') end

 RSpec
RSpec Ruby on Rails
Ruby on Rails Ruby
Ruby 
    