HI,
you can try by small change as follows,
521: def create_option
522: @option = Option.new
523: @option.name <http://o.name/> = "New Option"
524:
525: @option.save
...........................
....................
--
On Nov 15, 2007 11:26 PM, Paul <pschwarz99@...> wrote:
> I have been getting a strange error message and I can't figure out
> what's causing it, and haven't found the answer online anywhere. The
> error message says "Can't convert String into Integer" with this stack
> trace:
>
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3
> /lib/active_record/associations/association_proxy.rb:123:in
> `[]'
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3
> /lib/active_record/associations/association_proxy.rb:123:in
> `send'
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3
> /lib/active_record/associations/association_proxy.rb:123:in
> `method_missing'
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3
> /lib/active_record/associations/has_many_association.rb:98:in
> `method_missing'
> (eval):1:in `id'
> #{RAILS_ROOT}/app/controllers/admin_controller.rb:525:in `create_option'
>
> This is the function from controllers/admin_controller.rb
>
> 521: def create_option
> 522: @option = Option.new do |o|
> 523: o.name = "New Option"
> 524: end
> 525: @option.save
> 526: respond_to do |format|
> 527: format.js do
> 528: render :update do |page|
> 529: page.insert_html :bottom, "options", {:partial =>
> 'option', :object => @option}
> 530: end
> 531: end
> 532: end
> 533: end
>
> and models/option.rb
>
> class Option < ActiveRecord::Base
> has_many :attributes, :dependent => :destroy
> has_many :values, :through => :attributes
> end
>
> I have tried replacing "New Option" with a number and changing the id
> field to varchar(255) neither worked; this looks like something in the
> save function is going wrong and I'm getting a useless error message.
> If anyone has encountered and solved this problem, I would appreciate
> a tip.
>
> Thank You.
>
>
>
[Non-text portions of this message have been removed]