Push_with_attributes not inserting default values


#1

I have a join table A_B with columns[a_id, b_id, c_data default 1,
d_data default 1].
If I do:
@aobj.bobjs.push_with_attributes(@bobj,{:c_data => 0})
I find that the row inserted, has d_data set to 0 and not the default
value specified in the database, which is 1. So I am having to
explicitly set it using :
@aobj.bobjs.push_with_attributes(@bobj,{:c_data => 0, :d_data => 1}).

Is this a bug in Rails 1.0?

Also, is there a way I can see the SQL generated for any ActiveRecord
method while the application is running?

Thanks,
Yash


#2

Yash wrote:

Also, is there a way I can see the SQL generated for any ActiveRecord
method while the application is running?

Sorry not to have an answer for the first part of your question, but
when you are running in development mode (the default) you can see the
SQL your application is using in log/development.log

On Unix/Linux/Mac OS X, (or with Cygwin on Windows

tail -f log/development.log

to watch what is happening as your application executes.

regards

Justin