On Mar 6, 6:00 pm, Frederick Cheung <[email protected]>
wrote:
> > Rate.find_or_create_by_name(
> > :provider => lambda {
> > Provider.find_by_name(row['Provider_Name']) },
> > :name => row['Rate_Name'],
> > :preis => row['Preis']
> > )
> > end
> > end
> > end
>
> > But the association-key (provider_id) in the table "rates" won't be
> > writen to the database! I also tried accessing directly provider_id
>
> Why are you using lambda ?
it came from an earlier solution
Actually I need to fill the column "provider_id" in the table "rates"
with the associated key-id from the table "provider"!
When I do something like:
Rate.find_or_create_by_name(
:provider_id => Provider.find_by_name(row['Provider_Name']),
:name => row['Rate_Name'],
:preis => row['Preis']
)
the column just does not get filled.
Harm
> > :provider_id => lambda
> > { Provider.find_by_name(row['Provider_Name']) },
>
> > but didn't succeed. Any help is appreciated.
>
> > Thanks,
> > Harm
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.