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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:07:51+00:00 2026-06-03T07:07:51+00:00

I am using Ruby on Rails 3.2.2 and I would like to know if

  • 0

I am using Ruby on Rails 3.2.2 and I would like to know if there is a way to check if an attribute value has been set during the process flow. That is, I have an Article class with attributes title, content, updater_user_id.

In my controller I have:

# @article.title
# => "Sample title"
# @article.content
# => "Sample content"
# @article.updater_user_id
# => 1

# @current_user.id
# => 1 # Note: This value is the same as '@article.updater_user_id'
@article.updater_user_id = @current_user.id

# params[:article]
# => {:article => {:title => 'Sample title 2', :content => 'Sample content 2'}}
@article.update_attributes(params[:article])

I tried to use the @article.changed method but it doesn’t work as I would like it to work. In fact, that method returns:

@article.changed
# => ['title', 'content'] # Note: There isn't the 'updater_user_id' attribute

In other words, I would like to check if the updater_user_id has been set during the process flow even if that value has not changed. My use case is that I would like to require that the updater_user_id is set (at least one time) during the process flow before to save an Article object; if it is not set during the process flow, then I would like to raise an error or something like that.

Is it possible? If so, how to make that?

  • 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-03T07:07:53+00:00Added an answer on June 3, 2026 at 7:07 am

    Did you try xxx_will_change! method?

    # in Article class
      def updater_user_id=(new_updater_user_id)
        self[:updater_user_id] = new_updater_user_id
        updater_user_id_will_change!
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Ruby on Rails 3.1 and I would like to know (for
I am using Ruby on Rails 3.0.7 and I would like to know what
I am using Ruby on Rails 3 and I would like to know some
I am using Ruby on Rails 3 and I would like to know what
I am using Ruby on Rails 3 and I would like to know what
I am using Ruby on Rails 3 and I would like to know in
I am using Ruby on Rails 3.1 and I would like to know the
I am using Ruby on Rails v3.0.9 and I would like to know what
I am using Ruby on Rails 3.0.10 and I would like to know whether
I am using Ruby on Rails 3.2.2 and in my controllers I would like

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.