Problems with parsing params for Active Record

Hi,

I have come into an odd problem that I couldn't figure out why.
Basically, what I did is to save a record from the form, but there's
some field that parsed to the active record returns as nil.

Example:

article = Article.new({"title"=>"halo world","content"=>"lorem ipsum",
"tags"=>"test,article,fun","project_id"=>"1"})
#<Article id:nil, title: "halo world",content:"lorem ipsum", tags:nil,
project_id:nil>

I don't understand why tags and project_id is nil, while I supplied my
data.

My Migration Data

create_table :articles do |t|
      t.string :title
      t.text :tags
      t.text :keyword
      t.text :content
      t.references :project
end

I am running on ruby 1.8.6 entreprise and rails 2.3.5.

Have someone come across this before. Really need some advise.

Thanks

Are you using attr_protected anywhere (or are any plugins calling it
on your models) ?

Fred

Thanks for reply Frederick.

Is a new project. I didn't use any plugins. More funny thing is I
manually set the attributes without problem.

Example:
article.project_id=1

It works. However, not for parsing by array. I have did a few project
before, this is the first time encounter this funny issue. I try this
on rails console too, it is the same result.

Hi Frederick,

How about :

article = Article.new(:title =>"halo world",:content=>"lorem ipsum",
:tags=>"test,article,fun",:project_id=>"1")

This example can be found at http://api.rubyonrails.org/classes/ActiveRecord/Base.html

Did it worked out?

Hi Joao,

Is the same thing. Project ID and Tags leaves as nil for no reason.

Hi Joao,

Is the same thing. Project ID and Tags leaves as nil for no reason.

Are there any warnings in the console ? This really does sound an
awful lot like attr_protected or attr_accessible are being used
without you knowing it.

Fred