Google Groups Home
Recently Visited Groups | Help | Sign in
2.0 Fixtures with has_many :through ??
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  - Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Philipp Stangl  
View profile  
 More options Mar 12 2008, 1:29 am
From: Philipp Stangl <philipp.sta...@gmail.com>
Date: Tue, 11 Mar 2008 22:29:19 -0700 (PDT)
Local: Wed, Mar 12 2008 1:29 am
Subject: 2.0 Fixtures with has_many :through ??
hi!

did anyone get the new fixtures features (no join table, no ids) for a
has_many :through assocation running?

I did everything like I saw in a couple of screencasts and tutorials,
but they were all using a habtm association - what do I have to change
to get it to work with a has_many :through?

google didn't brought any results and a question in the rails forum by
someone else with the same problem was not answered by anyone - is it
possible that the new fixtures simply cannot be used with a
has_many :through currently? and if so, does anyone know if it is
planned to have it in the rails core in the next future?

thanks for any feedback!!

philipp


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nathan Esquenazi  
View profile  
(2 users)  More options Mar 12 2008, 2:45 am
From: Nathan Esquenazi <rails-mailing-l...@andreas-s.net>
Date: Wed, 12 Mar 2008 07:45:15 +0100
Local: Wed, Mar 12 2008 2:45 am
Subject: Re: 2.0 Fixtures with has_many :through ??
This is not currently supported as far as I know but there is a very
good reason why. First off, the general use case for has_many :through
is when you need to join two models AND include additional details about
the association. For instance if we have users and magazines then the
through association would be "subscription" BUT it also has other
attributes such as when the subscription was made and how many times
recurring payment has been received.

How would you specify the additional columns of information for the
relationship using the new fixtures method? The new way is just a list
of fixture names and would not be able to accommodate has many through
relationships that contained additional data.

I could imagine a syntax that could work but it would different. Not to
mention that in a has_many :through, the join table itself is a model
and so having fixtures for it somehow makes sense since it is actually
an activerecord model itself.
--
Posted via http://www.ruby-forum.com/.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
AndyV  
View profile  
 More options Mar 12 2008, 12:42 pm
From: AndyV <a...@cornell.edu>
Date: Wed, 12 Mar 2008 09:42:05 -0700 (PDT)
Local: Wed, Mar 12 2008 12:42 pm
Subject: Re: 2.0 Fixtures with has_many :through ??
I think the answer is not "It cannot be done for good reasons" but "It
can be done but it takes two steps."  Since you've taken the time to
declare the join table explicitly as a model that only makes sense.

On Mar 12, 2:45 am, Nathan Esquenazi <rails-mailing-l...@andreas-


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google