Changeset 9064
- Timestamp:
- 03/20/08 02:15:29 (2 months ago)
- Files:
-
- trunk/actionpack/lib/action_view/helpers/form_options_helper.rb (modified) (1 diff)
- trunk/actionpack/test/template/form_options_helper_test.rb (modified) (2 diffs)
- trunk/activerecord/lib/active_record/associations.rb (modified) (2 diffs)
- trunk/railties/README (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_view/helpers/form_options_helper.rb
r8473 r9064 53 53 # <option value="2">Sam</option> 54 54 # <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> 55 70 # </select> 56 71 module FormOptionsHelper trunk/actionpack/test/template/form_options_helper_test.rb
r8588 r9064 32 32 Country = Struct.new('Country', :country_id, :country_name) 33 33 Firm = Struct.new('Firm', :time_zone) 34 Album = Struct.new('Album', :id, :title, :genre) 34 35 end 35 36 … … 304 305 "<select id=\"post_category\" name=\"post[category]\"><option value=\"abe\" selected=\"selected\">abe</option>\n<option value=\"<mus>\"><mus></option>\n<option value=\"hest\">hest</option></select>", 305 306 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 }) 306 319 ) 307 320 end trunk/activerecord/lib/active_record/associations.rb
r8977 r9064 810 810 # is used on the associate class (such as a +Post+ class). You can also specify a custom counter cache column by providing 811 811 # 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. 812 814 # Note: Specifying a counter_cache will add it to that model's list of readonly attributes using #attr_readonly. 813 815 # * <tt>:include</tt> - specify second-order associations that should be eager loaded when this object is loaded. … … 825 827 # belongs_to :attachable, :polymorphic => true 826 828 # belongs_to :project, :readonly => true 829 # belongs_to :post, :counter_cache => true 827 830 def belongs_to(association_id, options = {}) 828 831 reflection = create_belongs_to_reflection(association_id, options) trunk/railties/README
r8155 r9064 32 32 (If you've downloaded Rails in a complete tgz or zip, this step is already done) 33 33 2. 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!"34 3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!" 35 35 4. Follow the guidelines to start developing your application 36 36