devise icon indicating copy to clipboard operation
devise copied to clipboard

Allow admin to add users

Open RichardGrossman opened this issue 9 years ago • 5 comments

Tried this: How To: Manage users through a CRUD interface

But still getting password blank error on save.

RichardGrossman avatar Dec 25 '16 11:12 RichardGrossman

REQUEST: Devise add a config option that allows a normal route and controller for the User model.

Until then, this hack works by going all around Rails and around Devise.

routes post 'savenew', to: 'users#savenew'

controller:

def savenew
 rawsql = "insert into users (name,email, created_at,updated_at) values ('#         
    {user_params[:name]}', '#{user_params[:email]}',now(), now())"
            sql = rawsql
        ActiveRecord::Base.connection.execute(sql)
        redirect_to action: 'index'
end

new.html.erb

<%= form_for modelname, :url => {:action => "savenew"} do |f| %>

RichardGrossman avatar Dec 25 '16 20:12 RichardGrossman

See on the wiki:

https://github.com/plataformatec/devise/wiki/How-to-manage-users-with-a-standard-Rails-controller-using-a-somewhat-CRUDE-HACK-that-WORKS!

RichardGrossman avatar Dec 26 '16 21:12 RichardGrossman

Please use the mailing list or StackOverflow for questions/help, where a wider community will be able to help you. We reserve the issues tracker for issues only.

nashby avatar Dec 27 '16 20:12 nashby

Seems like this is an issue.

RichardGrossman avatar Dec 28 '16 04:12 RichardGrossman

Can you please provide a sample application that reproduces the error?

nashby avatar Dec 28 '16 20:12 nashby