Ticket #9051: has_many_through_are_collections_too.diff
| File has_many_through_are_collections_too.diff, 3.5 kB (added by mathie, 1 year ago) |
|---|
-
actionpack/test/fixtures/db_definitions/sqlite.sql
old new 9 9 'content' text, 10 10 'created_at' datetime, 11 11 'updated_at' datetime, 12 'topic_id' integer 12 'topic_id' integer, 13 'developer_id' integer 13 14 ); 14 15 15 16 CREATE TABLE 'topics' ( -
actionpack/test/fixtures/developer.rb
old new 1 1 class Developer < ActiveRecord::Base 2 2 has_and_belongs_to_many :projects 3 has_many :replies 4 has_many :topics, :through => :replies 3 5 end 4 6 5 7 class DeVeLoPeR < ActiveRecord::Base -
actionpack/test/fixtures/reply.rb
old new 1 1 class Reply < ActiveRecord::Base 2 2 belongs_to :topic, :include => [:replies] 3 3 belongs_to :developer 4 4 5 validates_presence_of :content 5 6 end -
actionpack/test/fixtures/replies.yml
old new 1 1 witty_retort: 2 2 id: 1 3 3 topic_id: 1 4 developer_id: 1 4 5 content: Birdman is better! 5 6 created_at: <%= 6.hours.ago.to_s(:db) %> 6 7 updated_at: nil … … 8 9 another: 9 10 id: 2 10 11 topic_id: 2 12 developer_id: 1 11 13 content: Nuh uh! 12 14 created_at: <%= 1.hour.ago.to_s(:db) %> 13 15 updated_at: nil -
actionpack/test/activerecord/render_partial_with_record_identification_test.rb
old new 14 14 render :partial => @topic.replies 15 15 end 16 16 17 def render_with_has_many_through_association 18 @developer = Developer.find(:first) 19 render :partial => @developer.topics 20 end 21 17 22 def render_with_belongs_to_association 18 23 @reply = Reply.find(1) 19 24 render :partial => @reply.topic … … 47 52 assert_template 'replies/_reply' 48 53 end 49 54 55 def test_rendering_partial_with_has_many_association 56 get :render_with_has_many_through_association 57 assert_template 'topics/_topic' 58 end 59 50 60 def test_rendering_partial_with_belongs_to_association 51 61 get :render_with_belongs_to_association 52 62 assert_template 'topics/_topic' -
actionpack/lib/action_view/partials.rb
old new 64 64 else 65 65 render("#{path}/_#{partial_name}", local_assigns) 66 66 end 67 when Array, ActiveRecord::Associations::AssociationCollection 67 when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::Associations::HasManyThroughAssociation 68 68 if partial_path.any? 69 69 path = ActionController::RecordIdentifier.partial_path(partial_path.first) 70 70 collection = partial_path