Reputation: 1331
begin
# make a new outgoing call
@call = @client.account.calls.create(
:from => '+1*********',
:to => userphone,
:url => builturl
)
rescue StandardError => failedWith
# Create error entry
Deliveryerror.new(:objecttype => 1, :deliverytype => 1, :objectid => announce.id, :errormessage => failedWith, :user_id => user.id).save
end
This call is from a model called Usernotes and I am creating an instance of Deliveryerror. The call + save above work on rails console. I know the call goes into 'recue' but it is never saving a Deliveryerror entry to the db.
Env
Rails 3.1
Lion Server
Ruby 1.9.2
PostgreSQL
*Using delayed_job on this method call
Upvotes: 1
Views: 63
Reputation: 5897
You want to use .create
and not .new
-- .create
will save the object while .new
won't.
Upvotes: 1