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
Related
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
I want to show the devise login and signup pages on all views of my application, so it can be publicly accessible from anywhere, How can achieve this so I dont need to use the devise requests to show only the login or signup form?
You could extract the views from devise (mainly good for more customization) by running
rails generate devise:views
This will extract the devise views into your app/views path. Take the forms from there and add them to your existing application template.
See the devise documentation for more information.
I’m using Rails 4.2.1 and Devise and rails_admin and I’m quite new to Rails.
I need to add rails admin to my project. I need a separate login For rails admin. (I don't want to add a new column user for that. As admin and normal users are different) For that I added a new model Admin. I used devise for creating views and models. But now I need to add routes in routes for admin user having only sign in feature(No need for registration). Now I have all those features(registration,...). I also need a separate session apart from the user session. As I logout user, adminuser is also logging out.
To get seperate session please make changes in devise.rb
config.sign_out_all_scopes = false
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
After I create a devise as Users, where is users_controllers.rb?
Devise doesn't create a controller along with your model, so you have to generate it yourself:
rails g controller Users
Note that Devise uses its own internal controllers for things like session management and registrations. You can extend these, if you need to, but it is not mandatory.