I’m having the same troubles. I have a has_and_belongs_to_many
relationship which is causing me the same problem. I modify the model
from the association and it errors out when I save. This also worked
for me pre 1.1. Any ideas on how I can make this work and not be read
only? This only seems to be a problem with has_and_belongs_to_many
realtionships.
(three tables, crawlers, teams, crawlers_teams)
crawler model relationship
has_and_belongs_to_many :teams
for team in crawler.teams
team.name = “Mets”
team.save
end
Thanks,
Dallas
HH wrote:
Since I upgraded to 1.1, I am getting ‘ActiveRecord::ReadOnlyRecord’
exceptions when trying to save a specific record.
I read up on ActiveRecord::Base.readonly? but I don’t think the
condition
there (objects pulled in from a certain JOIN type) applies.
To answer my own question (and the guy before me).
Apparently you can’t use the has_and_belongs_to_many associations if you
want to update the model from the association because its made read only
based off this changelist. Instead it says to do a find by sql.
I’m having the same troubles. I have a has_and_belongs_to_many
relationship which is causing me the same problem. I modify the model
from the association and it errors out when I save. This also worked
for me pre 1.1. Any ideas on how I can make this work and not be read
only? This only seems to be a problem with has_and_belongs_to_many
realtionships.
(three tables, crawlers, teams, crawlers_teams)
crawler model relationship
has_and_belongs_to_many :teams
for team in crawler.teams
team.name = “Mets”
team.save
end
Thanks,
Dallas
HH wrote:
Since I upgraded to 1.1, I am getting ‘ActiveRecord::ReadOnlyRecord’
exceptions when trying to save a specific record.
I read up on ActiveRecord::Base.readonly? but I don’t think the
condition
there (objects pulled in from a certain JOIN type) applies.
I’ve been using Join Models myself, but wanted to use an “acts_as_list”
with
a many-to-many relationship.
Setting up something like this doesn’t currently work with a Join Model
approach.
Someone wrote a “acts_as_habtm_list” plugin that works great… but does
requires a non-Join Model approach.
If anyone has time to whip up a Join Model version of this, that would
be
great
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.