Whew! I was just confused. I forgot I had a attr_accessible setup
for the Request class. Once I added title_levels to that, everything
worked fine.
Now, it''s time to go bang my head against the wall....
On Nov 29, 12:09 pm, gobigdave
<gobigd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Please tell me I''m just confused, but this is very strange.
>
> I have a migration like so:
>
> class AddLevelToRequest < ActiveRecord::Migration
> def self.up
> add_column :requests, :title_levels, :string
> end
> def self.down
> remove_column :requests, :title_levels
> end
> end
>
> Run the migration, and from the console do:
>
> >> r = Request.new
>
> => #<Request:0x31a243c @attributes={"title_levels"=>nil,
> "department"=>nil, ...
>
> So far so good. My new attribute is there. Now do:
>
> >> r = Request.new(:title_levels => "1,2,3")
>
> => #<Request:0x30d3524 @attributes={"title_levels"=>nil,
> "department"=>nil, ...
>
> What happened? Where did my attribute value go? If I do:
>
> >> r = Request.new(:department => "1,2,3")
>
> => #<Request:0x30c7698 @attributes={"title_levels"=>nil,
> "department"=>"1,2,3", ...
>
> The department attribute was created with the table.
>
> I can do the following:
>
> >> r.title_levels = "1,2,3"
> => "1,2,3"
> >> r
>
> => #<Request:0x30c7698
@attributes={"title_levels"=>"1,2,3", ...
>
> Is something broken with add_column? I tried several different forms,
> but it seems that no matter what I do I can''t get new columns to
work
> with new. I also tried adding more columns, but all columns added with
> add_column exhibited the same behavior.
>
> I first noticed this when I tried to submit a form, but @request >
Request.new(params[:request]) was not picking up the title_levels
> field.
>
> I''m using Ruby 1.8.6, Rails 1.2.6, and MySql 5.0.41 on Max OS
10.4.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---