Phlip wrote:
>> It looks like the main issue is you are attempting to learn merb through 
>> updating someone elses code
>>     
>
> I forgot to mention that fixturing in two passes seems to work:
>
> def Post.fix(name, *tag_names)
>    p = fixture(name)
>    p.save
>
>    tag_names.each do |tag_name|
>      p.tags << Tag.fixture(tag_name)
>    end
>
>    return p
> end
>
> describe Post do
>
>    it 'should rank affinity' do
>      post_1 = Post.fix(:Joan_Crawford_Has_Risen, :progressive, :rock, :music)
>      post_2 = Post.fix(:We_Jammin,               :roots, :reggae, :music)
>      post_3 = Post.fix(:Sardonicus,              :progressive, :reggae, 
> :music)
>    end
>
> end
>
> So that looks like stuff we can bottle up and re-use in many specs...
>
>   
That wont create the many-to-many relationship records. If you tried 
doing Post.first.tags you would get an empty array.

You need to use p.add_tag(Tag.fixtures(tag_name))

If you aren't worried about that, then your code will work fine.

Derek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to