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

  • Home
  • SEARCH
  • 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 6073331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:15:34+00:00 2026-05-23T10:15:34+00:00

Ruby Version: 1.8 Rails Version: 2.3 I have a class in which I have

  • 0

Ruby Version: 1.8
Rails Version: 2.3

I have a class in which I have written ‘attr_writer :content’ and I have a custom reader method ‘content’. Doing it this way, content is NULL. I’ve checked out the values and they look like this:

--- &id001 !ruby/object:Email 
attributes: 
  created_at: 
  expired_at: 
  updated_at: 
  subject: Test Eblast
  content: 
  inline_attachments: 
  attachments: 
attributes_cache: 
  expired_at: 
changed_attributes: 
  subject: 
content: This is the body
errors: !ruby/object:ActiveRecord::Errors 
  base: *id001
  errors: !omap []

new_record: true

Notice the indentation of “content:” on the 2nd instance. It isn’t being written as an attribute, but something else…while the actual attribute isn’t being updated. When I take out ‘attr_writer’ and write my own getter/setter methods explicitly, everything works. Why is 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-05-23T10:15:35+00:00Added an answer on May 23, 2026 at 10:15 am

    attr_writer creates getter and setter methods for an instance variable, not an ActiveRecord attribute.

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

Sidebar

Related Questions

I'm using Ruby version 1.8.7 Rails version 3.0.3 I have a method called alive
I have a web server that hosts Ruby version 1.8.5. Which version of Rails
Rails 3.0.3 and Ruby 1.9.2 I have the following class class item < ActiveRecord::Base
Short and sweet, Is it ok to use (current version) Ruby 1.9.1 with Rails
Rather than scraping a Ruby version of this algorithm off the net I wanted
I have the ruby version manager installed and use the ruby implementation installed by
I am on rails 2.3.5 and have the latest Ruby installed and my application
I know how to find the version of rails I have: > Rails::VERSION::STRING >
I have a Ruby on Rails Website that makes HTTP calls to an external
Short version: In trying to deal with a legacy database in Ruby-on-Rails, I've come

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.