On 9 December 2010 11:35, Basti Schenk <[email protected]> wrote:
> #schema.rb
>
> ActiveRecord::Schema.define(:version => 20101124114645) do
>  ...
>  create_table "fos_products", :force => true do |t|
>    t.string   "name"
>    t.decimal  "price",       :precision => 8, :scale => 2
>    t.string   "description"
>    t.integer  "type_id"
>    t.integer  "size_id"
>    t.integer  "provider_id"
>    t.date     "valid_date"
>    t.integer  "card_nr"
>    t.integer  "card_char"
>    t.datetime "created_at"
>    t.datetime "updated_at"
>    t.boolean  "inactive",      :default => false
>    t.integer  "editor"
>  end
>  ...
> end

So what do you deduce from that?  Your fixtures load is trying to
write to a size field, yet there is no such field, only a size_id.  Do
I deduce that you have a sizes class with Product belongs_to size, and
in the fixtures you are trying to set a particular size value into the
fos_products table using the association?

If so then this does not seem to work with non-standard table names.
Whether there is a way round this I do not know.  The best solution is
to chuck the fixtures in the bin and move over to Factories, probably
Machinist or Factory Girl.  I prefer the former.  Once you work out
how to use them you will not regret the move.  If you just want to get
it going immediately then I suggest reverting to the manual method for
setting size_id, by providing a number for it and for the entries in
the sizes table.  I guess there are only a couple of sizes so this
should not be a problem.  A few global search/replace operations in
the fixtures should do it.  Of course this paragraph started with an
'if' so it may not be this at all.

Colin

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