Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9064

Show
Ignore:
Timestamp:
03/20/08 02:15:29 (2 months ago)
Author:
david
Message:

Docfixes (closes #11356, #11172, #10523)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/form_options_helper.rb

    r8473 r9064  
    5353    #     <option value="2">Sam</option> 
    5454    #     <option value="3">Tobias</option> 
     55    #   </select> 
     56    #  
     57    # Like the other form helpers, +select+ can accept an <tt>:index</tt> option to manually set the ID used in the resulting output. Unlike other helpers, +select+ expects this  
     58    # option to be in the +html_options+ parameter. 
     59    #  
     60    # Example:  
     61    #  
     62    #   select("album[]", "genre", %w[rap rock country], {}, { :index => nil }) 
     63    #  
     64    # becomes: 
     65    #  
     66    #   <select name="album[][genre]" id="album__genre"> 
     67    #     <option value="rap">rap</option> 
     68    #     <option value="rock">rock</option> 
     69    #     <option value="country">country</option> 
    5570    #   </select> 
    5671    module FormOptionsHelper 
  • trunk/actionpack/test/template/form_options_helper_test.rb

    r8588 r9064  
    3232    Country   = Struct.new('Country', :country_id, :country_name) 
    3333    Firm      = Struct.new('Firm', :time_zone) 
     34    Album     = Struct.new('Album', :id, :title, :genre) 
    3435  end 
    3536 
     
    304305      "<select id=\"post_category\" name=\"post[category]\"><option value=\"abe\" selected=\"selected\">abe</option>\n<option value=\"&lt;mus&gt;\">&lt;mus&gt;</option>\n<option value=\"hest\">hest</option></select>", 
    305306      select("post", "category", %w( abe <mus> hest ), :selected => 'abe') 
     307    ) 
     308  end 
     309   
     310  def test_select_with_index_option 
     311    @album = Album.new 
     312    @album.id = 1 
     313     
     314    expected = "<select id=\"album__genre\" name=\"album[][genre]\"><option value=\"rap\">rap</option>\n<option value=\"rock\">rock</option>\n<option value=\"country\">country</option></select>"     
     315 
     316    assert_dom_equal( 
     317      expected,  
     318      select("album[]", "genre", %w[rap rock country], {}, { :index => nil }) 
    306319    ) 
    307320  end 
  • trunk/activerecord/lib/active_record/associations.rb

    r8977 r9064  
    810810      #   is used on the associate class (such as a +Post+ class). You can also specify a custom counter cache column by providing 
    811811      #   a column name instead of a +true+/+false+ value to this option (e.g., <tt>:counter_cache => :my_custom_counter</tt>.) 
     812      #   When creating a counter cache column, the database statement or migration must specify a default value of <tt>0</tt>, failing to do  
     813      #   this results in a counter with NULL value, which will never increment. 
    812814      #   Note: Specifying a counter_cache will add it to that model's list of readonly attributes using #attr_readonly. 
    813815      # * <tt>:include</tt>  - specify second-order associations that should be eager loaded when this object is loaded. 
     
    825827      #   belongs_to :attachable, :polymorphic => true 
    826828      #   belongs_to :project, :readonly => true 
     829      #   belongs_to :post, :counter_cache => true 
    827830      def belongs_to(association_id, options = {}) 
    828831        reflection = create_belongs_to_reflection(association_id, options) 
  • trunk/railties/README

    r8155 r9064  
    3232   (If you've downloaded Rails in a complete tgz or zip, this step is already done) 
    33332. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options) 
    34 3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!" 
     343. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!" 
    35354. Follow the guidelines to start developing your application 
    3636