devise - show required fields - ruby-on-rails

is there a way to get devise to show * for required fields on sign up page in views?
rails 3.0.5 devise 1.2

Yes. If you run rails generate devise:views devise will generate its views into app/views/devise. Then you can add as many * as you like in there.
Have a look at the simple_form gem. It will add the * automatically and even provide inline validation. But this is just an addition, editing the views will solve your problem.

Related

A way to generate devise views that already include bootstrap CSS styling?

This devise generator saves a mountain of work by making all the views necessary for authentication:
rails g devise:views
Can the views above be generated but with bootstrap styling already included? E.g. perhaps similar to how rails new has the css=bootstrap option.
Note: I realise that styling is necessarily opinionated, however, it wouldn't be a bad thing since it would be a time-saver.
Maybe you can use rails templates.
An example with bootstrap and devise: https://github.com/lewagon/rails-templates
Note: It might be specific to the Le Wagon setup but I believe you can use the same approach to tailor it to your needs.
This gem adds bootstrap views:
https://github.com/kroger/devise-bootstrap5
Just add these two gems to your gemfile and you're basically done.
...
gem "devise-i18n"
gem "devise-bootstrap5"
...

Rails modify scaffold to use simple_form gem

Is it possible to modify rails scaffold command to generate forms using simple_form gem input fields?, instead of having the developer to edit each form and convert it to use simple_form data fields?
PS: I did Google and search Stack Overflow before posting, all I found was how to modify existing scaffold, which is not what I want.
Thank you
You can override the templates used for generated views by putting templates here:
lib/templates/erb/scaffold
take a look at:
Rails 3.1 - changing default scaffold views and template

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.

My custom devise views aren't displaying

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.

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

Resources