ruby - Rails 4 - Heroku logs -how to make sense of an error message -
i'm trying push code heroku.
i error message heroku logs. can't make sense of it.
so far can decipher, it's to user , roles models, are:
user
rolify attr_accessor :current_role has_and_belongs_to_many :roles, join_table: "users_roles"
role
class role < activerecord::base has_and_belongs_to_many :users, join_table: "users_roles" belongs_to :resource, :polymorphic => true validates :resource_type, :inclusion => { :in => rolify.resource_types }, :allow_nil => true scopify end
user_roles join table has:
create_table "users_roles", id: false, force: :cascade |t| t.integer "user_id" t.integer "role_id" end add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree
can understand error message means?
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.4/lib/active_record/associations.rb:1694: warning: initialized constant user::habtm_roles 2016-04-22t03:11:57.250562+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.4/lib/active_record/associations.rb:1694: warning: previous definition of habtm_roles here 2016-04-22t03:11:58.690994+00:00 app[web.1]: [3] ! unable load application: argumenterror: unknown key: :polymorphic. valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type 2016-04-22t03:11:58.691033+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.4/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys': unknown key: :polymorphic. valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type (argumenterror)
i found resource below describing how 'rolify' incorporates habtm relationship on user model doesnt need listed separately association, still error:
preloading application 2016-04-22t04:09:58.023038+00:00 app[web.1]: [3] ! unable load application: argumenterror: unknown key: :polymorphic. valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type 2016-04-22t04:09:58.023056+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.4/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys': unknown key: :polymorphic. valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type (argumenterror)
this:
unknown key: :polymorphic. valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :table_name, :before_add, :after_add, :before_remove, :after_remove, :extend, :primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type
makes me think line:
belongs_to :resource, :polymorphic => true
as polymorphic key see. wrong though.
Comments
Post a Comment