Forum: Ruby on Rails Adding model fields

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Richard W. (Guest)
on 2006-05-30 00:01
(Received via mailing list)
I added a field "url" to a table, modified the view to show the new
field.  Now I'm getting an error in the code that processes the form in
the view:


      copy_from_item = Item.find(params[:id])
      @item = Item.new(copy_from_item.attributes)


The second line here gives this error:



undefined method `url=' for #<Item:0x246e3f0>

RAILS_ROOT:
/Library/WebServer/Documents/Store/Inventory/public/../config/..
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1494:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1337:in `send'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1337:in `attributes='
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1336:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1336:in `attributes='
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
base.rb:1193:in `initialize_without_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/
callbacks.rb:236:in `initialize'
#{RAILS_ROOT}/app/controllers/items_controller.rb:121:in `new'
#{RAILS_ROOT}/app/controllers/items_controller.rb:121:in `create'


I thought that Rails magically handled new fields.  Not so?

What else do I need to do?
Charlie B. (Guest)
on 2006-05-30 00:03
restart your web server each time a table changes
>
> What else do I need to do?
Richard W. (Guest)
on 2006-05-30 00:07
(Received via mailing list)
On Monday, May 29, 2006, at 10:03 PM, charlie bowman wrote:
>http://lists.rubyonrails.org/mailman/listinfo/rails
Thank you.  (Fast response).  I just remembered!  I think that the dev
server will handle the new field.
This topic is locked and can not be replied to.