Hi, I''m encountering some strangeness on my production server, and
I''m
hoping someone has light to shed. I have a table ''new_titles''
with one
record and a custom ActiveRecord connection to the database w/ this
table mapped. I can select the record, but cannot save it. The problem
in not reproducible on my localhost either (table and all files are
same). Here''s what I''m getting:
[code]
irb(main):002:0> test = NewTitle.find(:first)
=> #<NewTitle:0xb76e35e0 @attributes={"title"=>"Rails
API",
"url"=>"http://api.rubyonrails.org/",
"id"=>"1",
"description"=>"Bookmark it please"}>
irb(main):003:0> puts test.title
Rails API
=> nil
irb(main):004:0> test.title = ''Ruby on Rails API''
=> "Ruby on Rails API"
irb(main):005:0> test.save!
ActiveRecord::StatementInvalid: Mysql::Error: MySQL server has gone
away: UPDATE new_titles SET `title` = ''Ruby on Rails API'',
`description` = ''Bookmark it please'', `url` =
''http://
api.rubyonrails.org/'' WHERE `id` = 1
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract_adapter.rb:128:in `log''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/mysql_adapter.rb:243:in `execute''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/mysql_adapter.rb:258:in `update''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1796:in `update_without_lock''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/locking/optimistic.rb:60:in `update_without_callbacks''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:267:in `update_without_timestamps''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/timestamp.rb:48:in `update''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1789:in `create_or_update_without_callbacks''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/callbacks.rb:242:in `create_or_update''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1551:in `save_without_validation!''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/validations.rb:762:in `save_without_transactions!''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:133:in `save!''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/database_statements.rb:
59:in `transaction''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:95:in `transaction''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:121:in `transaction''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:133:in `save!''
from (irb):5irb(main):006:0>
[/code]
Running the query directly on the MySQL command-line works as
expected.
There must be a difference between my local environment and that of
production (other than the obvious Mac/Linux difference). Gems are all
the same version, and MySQL hasn''t changed in either location. Any
ideas out there?
Thanks,
Aaron
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---