Ruby on Rails
Monday, June 4, 2012
Hi Guys,
I have model called CardAuthorization its perfectly working in development and production environments but not working in test environment, other models also working fine.
class CardAuthorization < ActiveRecord::Base
belongs_to :line_item_collection
belongs_to :user
end
belongs_to :line_item_collection
belongs_to :user
end
Error:
dhamodharan@client76:~/project/myproject$ rails c test
Loading test environment (Rails 3.2.3)
ruby-1.9.3-p194 :001 > CardAuthorization
=> CardAuthorization
ruby-1.9.3-p194 :002 > CardAuthorization.scoped
NoMethodError: undefined method `scoped' for CardAuthorization:Class
from (irb):2
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Ref:
(activerecord-3.2.3/lib/active_record/associations/association.rb:123:in `target_scope'
activerecord-3.2.3/lib/active_record/associations/association.rb:87:in `scoped'
activerecord-3.2.3/lib/active_record/associations/singular_association.rb:42:in `find_target'
activerecord-3.2.3/lib/active_record/associations/association.rb:145:in `load_target'
activerecord-3.2.3/lib/active_record/associations/association.rb:55:in `reload'
activerecord-3.2.3/lib/active_record/associations/singular_association.rb:9:in `reader'
activerecord-3.2.3/lib/active_record/associations/builder/association.rb:44:in `block in define_readers')
Loading test environment (Rails 3.2.3)
ruby-1.9.3-p194 :001 > CardAuthorization
=> CardAuthorization
ruby-1.9.3-p194 :002 > CardAuthorization.scoped
NoMethodError: undefined method `scoped' for CardAuthorization:Class
from (irb):2
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
from /home/dhamodharan/.rvm/gems/ruby-1.9.3-p194@myproject/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Ref:
(activerecord-3.2.3/lib/active_record/associations/association.rb:123:in `target_scope'
activerecord-3.2.3/lib/active_record/associations/association.rb:87:in `scoped'
activerecord-3.2.3/lib/active_record/associations/singular_association.rb:42:in `find_target'
activerecord-3.2.3/lib/active_record/associations/association.rb:145:in `load_target'
activerecord-3.2.3/lib/active_record/associations/association.rb:55:in `reload'
activerecord-3.2.3/lib/active_record/associations/singular_association.rb:9:in `reader'
activerecord-3.2.3/lib/active_record/associations/builder/association.rb:44:in `block in define_readers')
Working Fine in production and development environment:
dhamodharan@client76:~/project/myproject$ rails c production
Loading production environment (Rails 3.2.3)
ruby-1.9.3-p194 :001 > CardAuthorization
=> CardAuthorization(id: integer, user_id: integer, line_item_collection_id: integer, transaction_id: string, first_name: string, last_name: string, number: string, month: integer, year: integer, card_type: string, address1: string, city: string, state: string, zip: string, country: string, amount: decimal, captured: boolean)
ruby-1.9.3-p194 :002 >
Working fine in ruby-1.8.7-p334 and Rails 3.0.5:
dhamodharan@client76:~/Desktop/tmp/myproject$ rails c test
Loading test environment (Rails 3.0.5)
ruby-1.8.7-p334 :001 > CardAuthorization
=> CardAuthorization(id: integer, user_id: integer, line_item_collection_id: integer, transaction_id: string, first_name: string, last_name: string, number: string, month: integer, year: integer, card_type: string, address1: string, city: string, state: string, zip: string, country: string, amount: decimal, captured: boolean)
ruby-1.8.7-p334 :002 >
Any Idea or Suggestions please?
dhamodharan@client76:~/project/myproject$ rails c production
Loading production environment (Rails 3.2.3)
ruby-1.9.3-p194 :001 > CardAuthorization
=> CardAuthorization(id: integer, user_id: integer, line_item_collection_id: integer, transaction_id: string, first_name: string, last_name: string, number: string, month: integer, year: integer, card_type: string, address1: string, city: string, state: string, zip: string, country: string, amount: decimal, captured: boolean)
ruby-1.9.3-p194 :002 >
Working fine in ruby-1.8.7-p334 and Rails 3.0.5:
dhamodharan@client76:~/Desktop/tmp/myproject$ rails c test
Loading test environment (Rails 3.0.5)
ruby-1.8.7-p334 :001 > CardAuthorization
=> CardAuthorization(id: integer, user_id: integer, line_item_collection_id: integer, transaction_id: string, first_name: string, last_name: string, number: string, month: integer, year: integer, card_type: string, address1: string, city: string, state: string, zip: string, country: string, amount: decimal, captured: boolean)
ruby-1.8.7-p334 :002 >
Any Idea or Suggestions please?
--
Thanks
Dhamodharan N
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment