My custom devise views aren't displaying - ruby-on-rails

I created the /views/user/ folder using rails g devise:views but devise is still using the default views somehow.
Am I missing a configuration somewhere?

Yes, read documentation and add to your config/initializers/devise.rb
config.scoped_views = true
Also see that rails g devise:views create app/views/devise containing all needed views. If you don't have many Devise Models in your app DO NOT use above solution but simply edit files in app/views/devise. Then it will work faster, because it don't need to look every time for specified views.

Related

Devise views not generating

Devise works. I can login and log out, but there are no views in the my project. There is no app/views/devise folder. When I used rails g devise:views nothing appeared. How is Devise even working if there is no html, and how can I get these views to display in my project so I can edit them?
If files are not added, the files added into your gem folder and Devise will use them, but when you run the command, the created folder will just overwrite them.
If rails g devise:views still not working for you, one easy way to do this instead of trying to find what was the issue with the gem or Terminal is to just move them yourself.
Here you have the files Devise views, just copy paste them into your folder and you will be good.
Go to the application root directory and run following command to get views of devise:
rails g devise:views
I read on the documentation that you have to put this line in config/initializers/devise.rb
config.scoped_views = true
you will have access to the file for sessions,
and you can do too :
rails generate devise:views users
to have access to user files
You should take a look : https://github.com/plataformatec/devise
Hope that help

hide devise files and passwords

I'm working on a rails app and to modify the layout of devise pages i used on the root of my rails application
rails g devise:views
so in the directory
app/views
i have all the files of the devise gem.
now that my work is ended i would like to hide those files again maintaining the modifies , how can i do it?
if you know even a way to only hide password it could also work
i didn't found any help in the README file for the plugins

Applying custom layouts/colors to devise forms

I am a new bie to Rails Devise Gem. In order to apply a custom layout and coloring, I've modified original forms that come with devise installation. I am wondering if this approach is right. Or shall I create a new set of forms that should override default devise forms.
rails generate devise:views
Then, look at devise folder at views folder, you will see all the forms you need to customize
The correct method is to generate the devise views and then style them as you have been doing.

Using web-app-theme with devise

i've generated the devise views using rails g devise:views and then also followed the instructions to add the web-app-theme to sign but devise does not use that layout.
how you I change the devise layout to use web-app-theme?
You need to create a new layout file, specifically for logging in.
- app
- views
- layouts
application.html.erb
- devise
sessions.html.erb
So you have your application layout file, but you also have a folder called devise, and in it, is a layout file for devise sessions. Rails should automatically pick up this layout and use it since it is the same path and name as the view being displayed (views/devise/sessions) so it'll look for views/layouts/devise/sessions, and if it doesn't find it, it'll check if it's defined elsewhere.
UPDATE
Here's another potential solution I found on Stackoverflow.
Integrate layouts with Devise
UPDATE 2
A third option is to do what the devise wiki says.
How To: Create Custom Layouts

Devise - Where is the new.html.erb file located?

I just added users to my application using devise, and everything is working fine. But I can't see any folder of the type /views/users where I can change the new.html.erb and edit.html.erb to add new fields?
Does anyone know where these files would be located?
run
rails generate devise:views
that will place the view files in the views directory
From the docs:
Since Devise is an
engine, all its views are packaged
inside the gem. These views will help
you get started, but after sometime
you may want to change them. If this
is the case, you just need to invoke
the following generator, and it will
copy all views to your application: rails generate devise:views
You should run rails generate devise:views task to generate views

Resources