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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:41:15+00:00 2026-05-17T19:41:15+00:00

This is killing me… When trying to add a key to like so: category.site_ids

  • 0

This is killing me… When trying to add a key to like so:

category.site_ids << 1
category.save

It does not save. But when overriding completely, it works:

category.site_ids = [1]
category.save

What am I missing here?

  • 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-17T19:41:16+00:00Added an answer on May 17, 2026 at 7:41 pm

    The simple answer is that rails doesn’t support it 🙂 That might sound like a smartmouth answer, but let me explain. First, here’s the documentation.

    We want to think that category.site_ids is a regular array, but it’s not. In order for you to treat it like an array and have all the database magic (records created, updated, destroyed) behind the scenes, the rails developers have to override array methods. Arrays in ruby have several dozen methods, and making collection associations (has many, habtm) do all of them would be impractical.

    Now, you can do category.sites << site, and that works. So there’s no technical issue with doing the same for id’s. It might be a choice, or it might be that nobody has coded it yet 🙂

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

Sidebar

Related Questions

This is killing me! I'm trying to add the values of four fields together,
Simple question but this is killing my time. Any simple solution to add 30
This has been killing me all day, but I am not sure how to
Im killing the process in the port 4444, but this can change, i have
This is killing me. I've read these: http://msdn.microsoft.com/en-us/library/athddy89(v=VS.80).aspx http://msdn.microsoft.com/en-us/library/2baksw0z(v=VS.80).aspx But I don't see how
ok desperation. This is killing me.. I totally do not understand MapKit at all..
This one is killing me. I'm trying to make a simple console app that
This one is killing me,i'm a total noob with regex. Im trying to make
I'm killing myself trying to solve this routing error. Some background info: I'm using
this is killing me but is there any simple way to have objective-c code

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.