vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

Create and Update return Request Failed (code 500, Internal Error) #165

Closed barmstrong closed 13 years ago

barmstrong commented 13 years ago

Hi All,

I'm using the original https://github.com/activescaffold/active_scaffold in a Rails 2.3.10 project. So this isn't a true issue with vhochstein's version, but could be related so I wanted to post it here in case anyone can point me in the right direction.

When I do a create or update action, active_scaffold shows "Request Failed (code 500, Internal Error)" in the browser.

Here is the relevant console output:

Processing Admin::MarketsController#update (for 127.0.0.1 at 2011-06-28 10:54:16) [PUT]
  Parameters: {"commit"=>"Update", "action"=>"update", "_method"=>"put", "id"=>"21", "controller"=>"admin/markets", "_"=>"", "record"=>{"name"=>"Adelaide", "code"=>"adel", "country"=>"Australia", "tier"=>"3"}}
  User Load (0.7ms)   SELECT * FROM `users` WHERE (id=9083 and deleted=0) LIMIT 1
  User Columns (7.6ms)   SHOW FIELDS FROM `users`
  Market Load (0.3ms)   SELECT * FROM `markets` WHERE (`markets`.`id` = 21) 
  SQL (0.1ms)   BEGIN
  SQL (0.1ms)   ROLLBACK

TypeError (can't convert ActiveSupport::SafeBuffer into Hash):
  /Users/me/.rvm/gems/ree-1.8.7-2011.03@project/gems/after_commit-1.0.8/lib/after_commit/connection_adapters.rb:12:in `transaction'
  sass (3.1.1) rails/./lib/sass/plugin/rack.rb:54:in `call'
  config/initializers/cgi_session_hack.rb:42:in `call'
  /Users/me/.rvm/gems/ree-1.8.7-2011.03@project/gems/hoptoad_notifier-2.4.2/lib/hoptoad_notifier/rack.rb:27:in `call'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /Users/me/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/webrick/server.rb:82:in `start'

I was able to work around this by creating my own create and update methods in the controller which override the default ones created by active_scaffold. They look like this:

def create
  @record = Market.new(params[:record])
  if @record.save
    self.successful = true
    @insert_row = true
  end
  respond_to_action(:create)
end

def update
  @record = Market.find(params[:id])
  if @record.update_attributes params[:record]
    self.successful = true
  end
  respond_to_action(:update)
end

So I have a temporary work around for now but was wondering if anyone had encountered this or had a suggestion on how to fix it.

Thanks! Brian

vhochstein commented 13 years ago

At least I can tell you that you are the first one reporting this issue. Have you disabled backtrace silencer So should nt be a general issue. It s more likely that some other plugin/gem in combination with acitvescaffold is source of your issue.

However, I suggest to post to activescaffold group and explain your issue...

vhochstein commented 13 years ago

Will close this issue. In case of any further questions....