Search the web
Sign In
New User? Sign Up
RubyOnRails · Ruby on Rails
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Bizarre Error   Message List  
Reply | Forward Message #86 of 107 |
Re: [RubyOnRails] Bizarre Error

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]




Tue Jan 1, 2008 2:22 pm

suhas_p456
Offline Offline
Send Email Send Email

Forward
Message #86 of 107 |
Expand Messages Author Sort by Date

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...
Paul
feldar_99
Offline Send Email
Nov 15, 2007
6:13 pm

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:...
Bijesh Naidu
suhas_p456
Offline Send Email
Jan 1, 2008
2:45 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help