2011-10-10 30 views
35

Dự án này được xây dựng với đường ray 3.0.9.ERROR NoMethodError: phương thức chưa xác định `debug_rjs = 'cho ActionView :: Base: Class

Bây giờ tôi cập nhật các đá quý và Gemfile =>

source 'http://rubygems.org' 

gem 'rails', '3.1.1' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'pg' 
gem 'devise' 
gem "will_paginate" 
gem 'ruby-debug19' 
gem 'rack', '1.3.3' 
gem 'jquery-rails' 

Sau ray s, khi tôi làm, http://0.0.0.0:3000/ tôi nhận được lỗi này =>

=> Booting WEBrick 
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
[2011-10-10 17:50:23] INFO WEBrick 1.3.1 
[2011-10-10 17:50:23] INFO ruby 1.9.2 (2011-02-18) [i686-linux] 
[2011-10-10 17:50:23] INFO WEBrick::HTTPServer#start: pid=3103 port=3000 
[2011-10-10 17:50:31] ERROR NoMethodError: undefined method `debug_rjs=' for ActionView::Base:Class 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/railtie.rb:34:in `block (3 levels) in <class:Railtie>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/railtie.rb:33:in `each' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/railtie.rb:33:in `block (2 levels) in <class:Railtie>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:42:in `each' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/base.rb:216:in `<class:Base>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/base.rb:133:in `<module:ActionView>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_view/base.rb:8:in `<top (required)>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/abstract_controller/view_paths.rb:90:in `view_paths=' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/abstract_controller/view_paths.rb:76:in `prepend_view_path' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/engine.rb:532:in `block (2 levels) in <class:Engine>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:42:in `each' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_controller/base.rb:234:in `<class:Base>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_controller/base.rb:171:in `<module:ActionController>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_controller/base.rb:3:in `<top (required)>' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_dispatch/middleware/static.rb:31:in `ext' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_dispatch/middleware/static.rb:15:in `match?' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.1.1/lib/action_dispatch/middleware/static.rb:47:in `call' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/engine.rb:456:in `call' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/rack/content_length.rb:16:in `call' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/rack/log_tailer.rb:14:in `call' 
    /home/user1/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.3.3/lib/rack/handler/webrick.rb:59:in `service' 
    /home/user1/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
    /home/user1/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
    /home/user1/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 

Phải làm gì?

Trả lời

20

RJS đã được trừu tượng hóa khỏi Rails 3.1 và JQuery là mặc định mới.

http://weblog.rubyonrails.org/2011/4/21/jquery-new-default

Nếu bạn muốn sử dụng RJS, bạn cần bao gồm

gem 'prototype-rails' 

trong Gemfile

+0

gem install prototype-ray, tôi đã nhận lỗi => Đang tìm nạp: prototype-ray-3.1.0 .gem (100%) Đã cài đặt thành công prototype-rails-3.1.0 1 gem cài đặt Cài đặt tài liệu ri cho nguyên mẫu-ray 3.1.0 ... L ERI: Khi thực hiện gem ... (ArgumentError) dữ liệu soái quá ngắn – shibly

+1

Điều này sẽ "sửa chữa" nó (lỗi biến mất) nhưng có thể để lại nợ kỹ thuật. Tốt hơn hết là sử dụng câu trả lời của Gautam như là cách tiếp cận đúng. –

+0

Vấn đề vẫn chưa được giải quyết cho tôi .... – Rubyist

124

của bạn Nếu bạn muốn sử dụng jQuery thay vì RJS cho một ứng dụng hiện có , xóa hoặc nhận xét dòng sau từ config/environments/development.rb

# config.action_view.debug_rjs = true 
+8

Đây rõ ràng là câu trả lời đúng. – Matt

Các vấn đề liên quan