Ruby on Rails devise - No route matches [GET] "/users" - ruby-on-rails

First time using devise I'm a little confused. I've followed a tutorial that manually goes through authentication so I have some understanding of Rails in this respect.
Normally when you create a scaffold for a User you get a Users controller with all the methods for showing, editing, adding etc. users, which can be accessed through the browser via http://localhost:3000/users/[action].
I have destroyed the User scaffold and started again with devise (rails generate devise User) but this does not create a controller at all. Going to http://localhost:3000/users/ gives the error No route matches [GET] "/users".
Am I supposed to create my own controller? Where do I go from here?

I think you did not initialized devise. You should probably run
rails generate devise:install
And then generate model for User by running
rails generate devise User

Related

Ruby on Rails Devise I want to redirect to a specific page

I am hoping to make a transition to a specific page after successful login.
For example,
rails g controller Home
rails g model Home
How can I describe concretely if you override it with the after_sign_in_path_for method?
I would like to make the description of routes.rb as easy as possible. But I do not know what to do.

How to create a secondary login form in ruby on rails using devise

I'm relatively new to this. I am using devise with ruby and it generates its own sign in and sign up views. I was wondering in addition to this, if I can create a secondary form that I can embed in my homepage that will let people sign in or sign up without having to redirect them to the devise's initial sign in and sign up page. If it's possible, how am I going to create session with the provided information in the homepage.
You should use devise command rails generate devise:views to generate devise views and than you can include app/views/devise/new I think its on this location ,partial to your homepage and also you will need to update css and some html to fit your homepage/place/position.
Here you can find detailed info about custom sign in views with samples:
https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-app
Please check more info about devise views here: https://github.com/plataformatec/devise

How to destroy rolify and/or rename devise user model?

I have an Ruby 2 Rails 4 application generated by Rails Composer with Devise and Rolify. I am trying to rename the Devise User model, so I wanted to destroy it and generate it. However, I am getting errors trying to do so related to Rolify. I’ve made several attempts to destroy Rolify with no success and cannot get past that point so that I can work with Devise.
I am going to show several attempts to resolve this problem, along with the errors I get. Each attempt started with a fresh copy of the application. I show the error streams, only.
I basically have two questions:
1. How do I destroy rolify?
2. Is there a better way to rename the devise User model? I thought I found another way but, for the life of me, I can’t find it again..
Destroy rolify, the result being a failed attempt to subtract role.rb after it was removed.
rails destroy rolify Role User
invoke active_record
remove app/models/role.rb
invoke rspec
remove spec/models/role_spec.rb
invoke factory_girl
remove spec/factories/roles.rb
subtract app/models/role.rb
D:/BitNami/rubystack-2.0.0-11/ruby/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `binr
ead': No such file or directory - D:/BitNami/rubystack-2.0.0-11/projects/workingapp/app/models/role.rb (Errno::ENOENT)
Destroy devise model, generate devise model and generate rolify
rails destroy devise user
rails generate devise device
rails generate rolify Role Device.
invoke active_record
The name 'Role' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
Destroy devise model, generate devise model, delete app/models/role.rb and generate rolify
rails destroy devise user
rails generate devise device
del app/models/role.rb
rails generate rolify Role Device.
D:/BitNami/rubystack-2.0.0-11/ruby/lib/ruby/gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/inflector/methods.rb:
226:in `const_get': uninitialized constant Role (NameError)
I haven't been able to find anyway to do this. Backing off Rolify just doesn't seem to work. I've decided to use Rails Composer to create the application without Devise, Rolify and CanCan, then generate each of them individually with my desired model names and configurations. Then, I can migrate all of the code of written into that application and modify it. It's not an easy answer, but it seems to be the best choice...

how to get twice path in devise routes?

i want to make twice url for login devise, first i want the url become to
"/user/sign_in"
and other become to
"/admin/sign_in"
how do this in devise rails?
thank you before
rails generate devise User
rails generate devise Admin
will create different views and routes for each MODEL

RoR Active Admin adding Users

This might be a very simple questions as I am just getting started with RoR and been doing as much learning through resources as possible. Basically I am using Active Admin to handle the admin portion of my application. What I am wondering about is creating a user model. I know Active Admin uses Devise for its autherzation so if run rails generate active_admin:resource Userit should create the user model the same way as if I ran it with Devise correct?
The end goal is to have the main front end page be a login for users that are created by the admin on Active Admin (no sign up from the front end) that will lead them to the secure information like Profile, orders, what ever.
What you're looking to do (assuming that you want to separate out the idea of Admin Users versus regular users) is first generate the new devise model as you normally would:
rails generate devise user
Then create a resource to manage them within active admin
rails generate active_admin:resource User
The rest is a standard devise integration assuming the pages are outside the scope of Active Admin.

Resources