I have a User.create
action that provisionally registers a new user and sends an email with a generated password. What is the most Rails-like way to complete that action? I want to do everything exactly right from now on. No more nonsense. This time I'm serious.
I'm thinking these are the options...
Create a view called login_email_sent.html.haml
and render it. (It would have a message like "thanks, an email has been sent with your login.")
Create a view called create.html.haml
and let Rails render that by default.
Redirect the user to the same page as the form they just submitted with a message in the flash.
Or something else...?
This is more of a user experience question.
Leave the create action as something that just creates and has no output (or just a simple 201 Created
header if created by an API call). Do a redirect_to
to either:
In 99.9% of cases you shouldn't ever need a template for create.
def create
User.create(...)
respond_to do |format|
format.html { redirect_to signup_complete_url }
format.xml { render :head => :created }
end
end
For instance.