Ah thanks Colin, that was it!

On Wed, Dec 12, 2012 at 10:28 AM, Colin Law <clan...@googlemail.com> wrote:

> On 12 December 2012 15:18, Jarod Watkins <jwatk...@jarodw.com> wrote:
> > Hello,
> > I have two models that look like the following:
> >
> > ModelA:
> >   attr_accessible :date, ...
> >   has_many :modelb
>
> That should be modelbs, plural.
>
> >   accepts_nested_attributes_for :modelb
> > end
> >
> > ModelB:
> >   attr_accessible :date, ...
> >   belongs_to :modela, :modelc, :modeld
>
> I think you have to specify those on separate lines.
>
> Colin
>
> > end
> >
> > And then in ModelAs controller:
> >
> > @modela = Modela.new
> >
> > 3.times do |i|
> >   @modela.modelb.build(:date => Time.now)
> > end
> >
> > When ModelB has 3 belongs_to and I attempt to build the association with
> > just ModelA I get the following error:
> >
> > ArgumentError wrong number of arguments (3 for 2)
> >
> > When ModelB just belongs_to modela it works. Do I need to somehow setup a
> > fake association for the other belong_tos? Those are to be created in
> the UI
> > by the user.
> >
> > Thanks,
> > Jarod
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/rubyonrails-talk/-/Gv5tkWCmhlQJ.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to