ArgumentError on model create statement


#1

I have a rails app model that I’m getting a strange error that is just
baffling me. I’ve stripped everything out of my model down to the
basics and still get the error.

So, here is the current model:

class Metric < ActiveRecord::Base
end

When I go into the console, and issue a simple “Metric.create” command I
get the following error:

Metric.create
ArgumentError: wrong number of arguments (1 for 0)
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/callbacks.rb:288:in
callback' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/callbacks.rb:288:invalid?’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/validations.rb:1008:in
save_without_dirty' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/dirty.rb:79:insave_without_transactions’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:179:in
send' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:179:inwith_transaction_returning_status’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
transaction' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:129:intransaction’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:138:in
transaction' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:178:inwith_transaction_returning_status’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:146:in
save' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:158:inrollback_active_record_state!’
from
/src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/transactions.rb:146:in
save' from /src/parkassist/paseweb/vendor/rails/activerecord/lib/active_record/base.rb:693:increate’
from (irb):12

Any help? What am I missing and why does a simple create statement
through this ArgumentError?


#2

On 21 Feb 2009, at 00:08, Craig J. wrote:

I have a rails app model that I’m getting a strange error that is just
baffling me. I’ve stripped everything out of my model down to the
basics and still get the error.

So, here is the current model:

class Metric < ActiveRecord::Base
end
Any plugins in that app that are extending activerecord ?

Fred


#3

Thanks, but the plugins aren’t an issue. I found the problem.

I should have included my model attributes as well from the DB.

I had a DB column called “callback” which interfered with built-in AR
functionality.

Frederick C. wrote:

On 21 Feb 2009, at 00:08, Craig J. wrote:

I have a rails app model that I’m getting a strange error that is just
baffling me. I’ve stripped everything out of my model down to the
basics and still get the error.

So, here is the current model:

class Metric < ActiveRecord::Base
end
Any plugins in that app that are extending activerecord ?

Fred