I edit and update my Profile object in two different places and would like to serve a specific notice for each. For example, when I edit/update the Profile in settings_path I’d like to say something like “Updated user information successfully”. When I edit/update the Profile in join_path I’d like to say something like “Profile created” or nothing at all.
Is something like this possible?
Here’s my Profiles#update action:
def update
@profile = user.profile
if @profile.update_attributes(params[:profile])
redirect_to profile_path, :notice => 'Updated user information successfully.'
else
render :edit
end
end
You can check to see where the form was posted from using
request.referrer, e.g.That code can be cleaned up quite a lot but that’s the generate theme of it.