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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:32:37+00:00 2026-05-27T10:32:37+00:00

I am using virtual attributes to break out a comma separated parameter list in

  • 0

I am using virtual attributes to break out a comma separated parameter list in the view, and then trying to recombine them to save into my Active Record model.

Given the real attribute “ad_columns” that defaults to “1,1,1,1”

I am breaking them out in to individual attributes for the form:

attr_accessor :top_rows

#Getter
def top_rows
  split = ad_rows.split(',', 4)
  split[0]
end

#Setter
def top_rows=(trows)
  ad_rows_will_change!
  self.ad_rows = [trows, self.right_rows, self.bottom_rows, self.left_rows].join(",")
end

Then repeating this for right, bottom, left and right.

Given an object if I call “object.top_rows” I do get “1”, and if I update it in irb:

object.top_rows = "3"

Then it updates the ad_rows real attribute properly. I can see that the object has changes, and when I do an

object.save

The changes are updated in the database.

The problem is, this is NOT working from the view. It will not save to the database. I have even used logger.info to see if the model has changed and it will show that “ad_rows” has indeed been changed, yet active record is still NOT updating the real attribute.

I can’t figure out why this is happening. Am I just doing it wrong? 🙂 Thanks.

Why would it work in irb but not the view?

  • 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-27T10:32:37+00:00Added an answer on May 27, 2026 at 10:32 am

    It seems that since the attribute :ad_rows was not being passed in the parameters, it was not being recognized as changed by the controller.

    I had to add:

    object.ad_rows_will_change!

    To my controller to force it to save the ad_rows column.

    I am not sure if this is the best solution, but it is working for now.

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

Sidebar

Related Questions

I am using virtual attributes to save tags in an Entry model from a
I'm currently trying to reverse geocode a series of lat/long co-ordinates using the Virtual
I am using virtual machines for development,but each time I need a new VM,
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
I'm working on a graphics application that is using virtual classes fairly extensively. It
What is the best breakdown of responsibility when using a virtual grid and the
I want to implement my own clustering algorithm using this Virtual Earth javascript API:
I have this code to show a map using the Virtual Earth API: <script
Is it possible to clone a virtual machine using VMware Fusion on Mac OS
I have created a web service in a virtual directory using VS 2008. I

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.