Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change devise's flash[:notice] in rails

I'm using rails 2.3.5 and devise 1.0.6. I'm having users confirm account's with email. However, when a new user sign's up the flash notice says "The user was successfully created" which it was but it doesn't tell the user that they need to confirm their their email unless they try to log in and devise's flash notice still doesn't explain that they have to confirm through email.

Where is this flash notice located in the gem and how can I change it? Or what is a better way to fix this problem.

like image 544
thenengah Avatar asked Aug 07 '10 19:08

thenengah


People also ask

What is a flash error Message?

A flash message is a way to communicate information with the users of your Rails application so they can know what happens as a result of their actions. Example messages: “Password changed correctly” (confirmation) “User not found” (error)

How do flash messages work Rails?

Flash messages are notifications and alerts that pop up in the interface of an application in order to communicate with the user and ease of interaction. Applications often apply flash messages to tell the user if the login was correct or to confirm the success of the action triggered by clicking a button.

What is devise gem in Ruby on Rails?

Devise is the cornerstone gem for Ruby on Rails authentication. With Devise, creating a User that can log in and out of your application is so simple because Devise takes care of all the controllers necessary for user creation ( users_controller ) and for user sessions ( users_sessions_controller ).

What does flash do in Ruby?

To implement such messages, Rails provides the flash. The flash is basically a hash that controllers and ERBs can read and write. The flash is part of the session, so the data stored in the flash are specific to a particular user session.


2 Answers

Just enable i18n in your project and edit the default locale (en.devise.yml) or download new ones from https://github.com/plataformatec/devise/wiki/i18n

like image 100
knoopx Avatar answered Sep 28 '22 03:09

knoopx


Flash messages for the devise gem can be altered in the locales directory (YourRailsApp/config/locales/devise.en.yml).

Just change the devise.en.yml to your liking, it doesn't really take any programming knowledge.

If you are new to rails the locales directory is for I18n translations which is rails way of translating words albeit statically but it works well for simple projects.

like image 26
thenengah Avatar answered Sep 28 '22 04:09

thenengah