I\'m using devise in my Ruby on Rails project and users have an admin-attribute:
schema.rb:
create_table \"users\", force: :cascade do |t|
I figured it out:
devise_for :users,: :path_prefix => 'my'
resources :users
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
to: <%= form_for(@user) do |f| %>
Add this to the usercontroller:
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update(user_params)
redirect_to adminpanel_path
else
render 'edit'
end
end
Done. (strangely, I can't put number 5 in code)