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 8960329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:38:17+00:00 2026-06-15T15:38:17+00:00

I am trying to do an after_save conditional callback after_save :change_rel_status, :if => :relation_type_id

  • 0

I am trying to do an after_save conditional callback

after_save :change_rel_status, :if => :relation_type_id == 1

def change_rel_status
  self.status = "Confirmed"
  self.save
end

But I get the error message undefined method after_save for false:FalseClass

{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"f4IN...=",
"relationship"=>{"relation_type_id"=>"1",
"category_ids"=>[""]},
"commit"=>"Update Relationship",
"id"=>"19"}

I am not sure if it’s because the form also has other attributes from other models that were not updated?

Thanks.

  • 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-06-15T15:38:17+00:00Added an answer on June 15, 2026 at 3:38 pm

    May I suggest something simpler:

    before_save :change_rel_status
    
    def change_rel_status
      if params[:relationship][:relation_type_id] == 1
        self.status = "Confirmed"
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to inject an after_save callback via a mixin, but my rspec tests
I am getting an error running the following method in an after_save callback NoMethodError
I am trying to save 'non english' characters in mysql table. But when I
I'm trying to get the ID of my new record after I save it.
I am trying to save a photo with a button to camera roll after
After trying to get the mercurial repository explorer setup on my shared hosting with
I'm trying to avoid the N+1 queries problem with eager loading, but it's not
I have a FileUpload control. I am trying to save the file that is
I'm trying to set the subject of a patch I'm sending manually, but for
I trying to save my plist after a simple detail change. Here's the line

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.