I want in my application AdminUsers and normal Users. What Is the best way to have this?
What I tried is this. I started with a brand new rails app
rails new testadmin
added ActiveAdmin to the Gemfile
gem 'activeadmin'
gem 'sass-rails'
gem "meta_search", '>= 1.1.0.pre'
And generate the admin interface
rails generate active_admin:install
then following the instructions provided by the shell.
I have now AdminUsers in ActiveAdmin. I then generated a User model for Devise:
rails generate devise User
rake db:migrate
and added it to the Admin interface
rails generate active_admin:resource User
This seems to work as I now have a fancy User page with filters and the ability to add a new User, but whenever I try to add it (setting the email and a password), I get the following exception:
ActiveModel::MassAssignmentSecurity::Error in Admin::UsersController#create
Can't mass-assign protected attributes: encrypted_password, reset_password_token, reset_password_sent_at(1i), reset_password_sent_at(2i), reset_password_sent_at(3i), reset_password_sent_at(4i), reset_password_sent_at(5i), remember_created_at(1i), remember_created_at(2i), remember_created_at(3i), remember_created_at(4i), remember_created_at(5i), current_sign_in_at(1i), current_sign_in_at(2i), current_sign_in_at(3i), current_sign_in_at(4i), current_sign_in_at(5i), last_sign_in_at(1i), last_sign_in_at(2i), last_sign_in_at(3i), last_sign_in_at(4i), last_sign_in_at(5i), current_sign_in_ip, last_sign_in_ip
How to get what I'm after? Thanks
PS: I really hope they'll add ActiveAdmin and Devise as standard, out of the box components for Rails like Django has its admin interface and user model :/