小编vaj*_*vin的帖子

用于Rails :: Generator :: Base的未定义方法`write_inheritable_attribute':Class(NoMethodError)

我在rails上工作,突然rails服务器停止工作.它工作正常,我使用了以下命令[平台窗口7]

gem install -v=2.3.5 rails
Run Code Online (Sandbox Code Playgroud)

当我使用时rails s,它会给出以下错误:

c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:90:in `<class:Base>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:85:in `<module:Generator>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:48:in `<module:Rails>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator/base.rb:6:in `<top (required)>'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails_generator.rb:34:in `<top (required)>'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/bin/rails:14:in `<top (required)>'
    from c:/Ruby193/bin/rails:23:in `load'
    from c:/Ruby193/bin/rails:23:in `<main>'

$ rails -v
Rails 2.3.5
$ ruby -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails-3

14
推荐指数
3
解决办法
1万
查看次数

期望css"标题"与水豚文本

我在铁轨中使用水豚代替webrat.我已经安装了水豚并在Gemfile中使用了宝石'capybara'.我用的时候

page.should have_selector("title", :text => "anything title")
Run Code Online (Sandbox Code Playgroud)

它给出了一个错误

Failure/Error: page.should have_selector("title", :text => "anything title")
expected css "title" with text "anything title" to return something
Run Code Online (Sandbox Code Playgroud)

测试文件如下:

require 'spec_helper'

describe "Test pages" do  
  describe "Home page" do    
    it "should have the content 'Demo App'" do
    visit '/test_pages/home'      
    page.should have_selector("title", :text => "anything title")               
  end
 end
end
Run Code Online (Sandbox Code Playgroud)

rspec capybara

8
推荐指数
1
解决办法
7587
查看次数

没有路由匹配Rails中的资产/图像

在轨道上工作,图像不可见并出错.

Started GET "/assets/home.png" for 127.0.0.1 at 2012-06-19 12:23:24 +0530
Served asset /home.png - 404 Not Found (24ms)
ActionController::RoutingError (No route matches [GET] "/assets/home.png"):
Run Code Online (Sandbox Code Playgroud)

我用过命令

rake assets:precompile
Run Code Online (Sandbox Code Playgroud)

production.rb

config.assets.compress = true
config.assets.compile = false
Run Code Online (Sandbox Code Playgroud)

application.rb中

config.assets.enabled = true
config.assets.version = '1.0'
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!

asset-pipeline

8
推荐指数
1
解决办法
1万
查看次数

无法在rails中验证CSRF令牌的真实性

我正在使用PaypalAdaptive.它正确发送ipn_notification.ipnNotification动作方法如下 -

def ipn_notification
    ipn = PaypalAdaptive::IpnNotification.new
    ipn.send_back(request.raw_post.to_json)

    print "=====================request.raw_post#{request.raw_post}=============="

    if ipn.verified?
        PaymentMailer.notify_unknown(request.raw_post).deliver
    else
        logger.info "IT DIDNT WORK"
    end
    render :nothing => true
end
Run Code Online (Sandbox Code Playgroud)

但它返回错误

WARNING: Can't verify CSRF token authenticity rails
Run Code Online (Sandbox Code Playgroud)

对此问题有任何帮助.

ruby-on-rails csrf paypal-adaptive-payments

8
推荐指数
2
解决办法
9810
查看次数

错误H13(没有响应连接关闭)Heroku

我正在研究Ruby on Rails.一个在本地服务器上正常工作的项目,当我在heroku上部署它时会出现以下错误.谢谢!

2012-06-12T14:19:23+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET sheets-vip.heroku.com/ dyno=web.1 queue= wait= service= status=503 bytes=
2012-06-12T14:19:23+00:00 heroku[nginx]: 122.179.134.45 - - [12/Jun/2012:14:19:23 +0000] "GET / HTTP/1.1" 503 601 "-" "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0" myapp1101.heroku.com
2012-06-12T14:27:35+00:00 app[web.1]: !! Unexpected error while processing request: can't modify frozen array
2012-06-12T14:27:35+00:00 heroku[router]: Error H13 (Connection closed without response) -> GET sheets-vip.heroku.com/ dyno=web.1 queue= wait= service= status=503 bytes=
2012-06-12T14:27:35+00:00 heroku[nginx]: 122.179.134.45 - - [12/Jun/2012:14:27:35 +0000] "GET / HTTP/1.1" …
Run Code Online (Sandbox Code Playgroud)

heroku ruby-on-rails-3.2

5
推荐指数
1
解决办法
4716
查看次数

`next_migration_number':在轨道中使用wysihat-engine的NotImplementedError(NotImplementedError)

我正在使用以下gem作为编辑器.

gem "wysihat-engine", "~> 0.1.13"
Run Code Online (Sandbox Code Playgroud)

当我运行'rails generate wysihat'时,它会生成所有图像文件,但无法生成迁移并产生以下错误

c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/generators/migration.rb:30:in `next_migration_number': NotImplementedError (NotImplementedError)
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/generators/migration.rb:49:in `migration_template'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/wysihat-engine-0.1.13/lib/generators/wysihat_generator.rb:60:in `install_wysihat'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/generators.rb:170:in `invoke'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands/generate.rb:12:in `<top (required)>'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from c:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:29:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!

ruby-on-rails wysihat

4
推荐指数
2
解决办法
717
查看次数