When I first started learning ruby on rails I wrote my controller
actions by using if else statements to display error messages in case
something failed a validation. Like:
if @user.save
flash[:notice] = "User was saved"
redirect_to whatever
else
flash[:error] = "There was an error saving the user"
end
Im trying to use the beast forum plugin and in the controller actions
there are no if else statements and it looks really clean. like it
just has:
def create
@forum.attributes = params[:forum]
@forum.save!
....
end
Im wondering, does it just rely on validations for the error
handling? And if so, is this good practice?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---