Hello, I am a newbie Ruby developer.
I have an "Bookstore" application consisting of Books Prices.
In the Edit page, I am trying to associate Books with Price. The Books and Prices has a has_one relationship and belongs_to relationship.
class Book < ActiveRecord::Base belongs_to :price end
class Price < ActiveRecord:Base has_one :book end
table book ( id int, title varchar(20) price_id int );
table price ( id int amount float );
When I enter the Amount in the Edit page, I get the following error:
Price(#-616403668) expected, got String(#-610120718)
/home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/associations/association_proxy.rb:214:in `raise_on_type_mismatch' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/associations/belongs_to_association.rb:22:in `replace' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/associations.rb:1106:in `price=' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/base.rb:2361:in `send' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/base.rb:2361:in `attributes=' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/base.rb:2360:in `each' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/base.rb:2360:in `attributes=' /home/hemal/src/ruby/rubygems-1.1.1/gems/activerecord-2.1.0/lib/ active_record/base.rb:2261:in `update_attributes' app/controllers/books_controller.rb:63:in `update' app/controllers/books_controller.rb:62:in `update'
How do I fix the error? Any help will be greatly appreciated,
/hemal.