Аз съм нов в rails. Използвам rolify gem за добавяне на потребителски роли. Получавам този проблем, когато се опитвам да добавя роля от rails конзолата. Някой сблъсквал ли се е с този проблем?
u = User.first
u.add_role(:admin).save!
списък с грешки ===
ActiveRecord::RecordInvalid: Validation failed: Resource type is not included in the list.
Rolify миграционен файл ============
class RolifyCreateRoles < ActiveRecord::Migration
def change
create_table(:roles) do |t|
t.string :name
t.references :resource, :polymorphic => true
t.timestamps
end
create_table(:users_roles, :id => false) do |t|
t.references :user
t.references :role
end
add_index(:roles, :name)
add_index(:roles, [ :name, :resource_type, :resource_id ])
add_index(:users_roles, [ :user_id, :role_id ])
end
end`
Проследих документацията за инсталиране на rolify от тук == https://github.com/RolifyCommunity/rolify