rails / prototype-rails

Add RJS, Prototype, and Scriptaculous helpers to Rails 3.1+ apps
MIT License
55 stars 142 forks source link

config.action_view.debug_rjs #10

Open scytacki opened 12 years ago

scytacki commented 12 years ago

I'm trying to move an app from 3.0 to 3.2. When I do so, I have to comment out the config.action_view.debug_rjs = true line otherwise I get this error:

~/.rvm/gems/ruby-1.9.3-p125@rigse/gems/actionpack-3.2.2/lib/action_view/railtie.rb:34:in block (3 levels) in <class:Railtie>': undefined methoddebug_rjs=' for ActionView::Base:Class (NoMethodError)

looking at the prototype-rails code I don't see how the config.action_view.debug_rjs = true line could work because prototype-rails doesn't seem to create the debug_rjs method anywhere.

codyrobbins commented 12 years ago

I’m also seeing this. There’s a pull request to address this in #11.

esb commented 11 years ago

Removing the option from the README doesn't really solve the problem.

Just add the following code to the bottom of application.rb

# Restore debug_rjs flag for use with prototype-rails

module ActionView
  class Base
    # Specify whether RJS responses should be wrapped in a try/catch block
    # that alert()s the caught exception (and then re-raises it).
    cattr_accessor :debug_rjs
    @@debug_rjs = false
  end
end
Lordnibbler commented 10 years ago

this appears to still be an issue for 3.1/3.2 version; adding @esb's suggested code to the application.rb solves the issue, but its a bit of a hack seeing as that this code already exists in the gem: https://github.com/rails/prototype-rails/blob/master/lib/prototype-rails/on_load_action_view.rb#L7-L10

what gives?

waterman112 commented 7 years ago

it works use esb's way