Adding model fields

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:insend’
/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:ineach’
/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:ininitialize_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:innew’
#{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?

restart your web server each time a table changes

What else do I need to do?

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.