Rails related models exits with "NameError uninitialized constant" -
My two models are user and leave
class users & lt; ActiveRecord :: Base is has_many: Leaves ... Skip end class
which are the basic models for the user's many cards and addresses are for the user but when I do I get this strange error in the users_controller <@ "uninitialized constant user :: leaf" but I do not I know that "where" is wrong all the migration and the shama Before this code checked by RB, I am calling @ pages2 = Leave.all and it is recovering, but when I do "@ user.leaves" it will break with "500 internal server error" on the console Gets, nameError. Can there be an error in catching this error or something similar to see where this error is coming from? Also @ console = @ user in train Leaves can not be found, it has been removed from the name ": Unused Stable User :: Lef"
@leaves = @ user.leaves
Active records look at the singular form of leaves that you can override by using the flags
config / initializers / inflections.rb
ActiveSupport :: Inflector.inflections | Inflect | Inflect.irregular 'vacation', 'leaves' end
Comments
Post a Comment