Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7550577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:14:54+00:00 2026-05-30T10:14:54+00:00

I edit and update my Profile object in two different places and would like

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:14:55+00:00Added an answer on May 30, 2026 at 10:14 am

    You can check to see where the form was posted from using request.referrer, e.g.

    def update
      @profile = user.profile
      if @profile.update_attributes(params[:profile])
        if request.referrer == settings_path
          notice_message = 'Updated user information successfully'
        elsif request.referrer == join_path
          notice_message = 'Profile created'
        else
          notice_message = 'Profile Updated'  # default message
        end
    
        redirect_to profile_path, :notice => notice_message
      else
        render :edit
      end
    end
    

    That code can be cleaned up quite a lot but that’s the generate theme of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I need to add two new properties to the Profile object for asp.net
How would you prevent other users from editing a object, say a profile object
Dynamically I want to edit/update hosts(etc/hosts) file to add domain. To edit hosts(etc/hosts) file
Is it possible to edit and update a GridView cell without using <asp:TemplateField> and/or
i am using devexpress grid with edit functioality to update the records in the
EDIT: Modified title and added update. UPDATE : We no longer believe this is
I have an update panel in a repeater (Edit: I removed Runat and Id
I have an Edit action and an Edit view to allow users to update
def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.