Rails: test module and model conflict -
it mistake, called model test
(cause test). late rollback , give model name, because way need check lot of code on changing model name. problem. when call test in console, causes error.
>> user.last #<user id: 44, email: nil, password_digest: nil, created_at: "2013-05-08 11:26:04", updated_at: "2013-05-08 11:26:04", guest: true> user load (4.0ms) select "users".* "users" order "users"."id" desc limit 1 >> @test=test.last nomethoderror: undefined method `last' test:module (irb):7 c:/ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start' c:/ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start' c:/ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>' c:/users/hp/study/script/rails:6:in `require' c:/users/hp/study/script/rails:6:in `<top (required)>' -e:1:in `load' -e:1:in `<main>'
what can do?
you can rename model, rails g migration rename_test
. edit migration so
class renametest < activerecord::migration def self.up rename_table :test, :my_test end def self.down rename_table :my_test, :test end end
Comments
Post a Comment