On Mar 6, 9:12 pm, harm <[email protected]> wrote:
> On Mar 6, 6:00 pm, Frederick Cheung <[email protected]>
> wrote:
>

>
> 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.

When filling an id column like that you should probably be passing an
id rather than a Provider object (although :provider =>
Provider.find_by_name(...) should be ok).
Sounds like you should break this down into smaller steps so that you
see where it is going wrong (eg so that you can check whether a
provider is being found at all)

Fred

-- 
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.

Reply via email to