ruby on rails - Model tries to use different table name in production than in development -
i have model called user
. have pluralize_table_names
set false table user
uses user
. (that's kind of mouthful!)
interestingly, model behaves correctly in development in production user
tries use table called users
doesn't exist. other models use singular table names. @ this:
$ rails console loading development environment (rails 3.0.3) irb(main):001:0> client.table_name => "client" irb(main):002:0> appointment.table_name => "appointment" irb(main):003:0> user.table_name => "user" irb(main):004:0> $ rails console production loading production environment (rails 3.0.3) irb(main):001:0> client.table_name => "client" irb(main):002:0> appointment.table_name => "appointment" irb(main):003:0> user.table_name => "users" irb(main):004:0>
as can see, everything's fine except user
in production. gives?
edit: here's model code in production:
class user < activerecord::base acts_as_authentic end
and in development:
class user < activerecord::base acts_as_authentic end
same exact thing. pointed production instance @ same database development , problem persists. started having these problems when started using authlogic, i'm starting suspect development environment somehow knows authlogic stuff production environment doesn't.
update: tried kill many moving parts possible. set both production environment , development environment point @ dev database. didn't change anything. changed production environment dev 1 , started working. changed dev environment production 1 , stopped working. tells me there's change dev production makes stop working. have no idea what, though.
i figured out. ended keeping singular user
table name in database, in model, did this:
class user < activerecord::base set_table_name "user" acts_as_authentic end
the directives have in order or else not work! don't know why that's case (actually, if think little bit, makes sense) , don't know why decided try switch order i'm glad did.
Comments
Post a Comment