nilclass专题提供nilclass的最新资讯内容,帮你更好的了解nilclass。
我刚刚创建了一个新的应用程序从rails4.0.0.rc1与1.9.3-p374(这应该按照指南). 但是,我无法做一个简单的创建动作. class Books def create @book = Book.new book_params if @book.save redirect_to @book else render action:
我正在运行Rails 3.0.3,我在我的迁移中不小心造成了错字:我创建了一个迁移,它创建一个具有boolen类型的新列(它应该是布尔值).我运行了迁移,Rails没有提醒我,这是一个无效的列,我可以在以前的版本中发布它? 现在每当我尝试在迁移中添加,删除或修改任何内容时,我会收到以下错误信息: undefined method `to_sym’ for nil:NilClass 我甚至不能回滚或
这是我的spec文件看起来像:spec / api / v1 / projects_spec.rb require "spec_helper" describe "/api/v1/projects", :type => :api do context "projects viewable by this user" do it "JSON" do end end end 它包
我正在试图让一台新的生产服务器正常运行,它是如此接近.当我执行 RAILS_ENV=production rake assets:precompile 返回此错误 undefined method `[]' for nil:NilClass 当我用–trace运行它时,它被重新调用 $RAILS_ENV=production rake assets:precompile --trace ** In
好的,我确实有以下代码 def update_state_actions states.each do |state| @state_turns[state.id] -= 1 if @state_turns[state.id] > 0 && state.auto_removal_timing == 1 end end 现在在…的行 @state_turns[stat
运行测试时,我有一个问题,它使用模型之间的关联. 这是我得到的错误,一旦我运行rake测试: ERROR["test_truth", SevenPortfolioTest, 0.005154775] test_truth#SevenPortfolioTest (0.01s) NoMethodError: NoMethodError: undefined method `type'
遇到Pundit我不理解的事情, 使用Rails 4.2.5.1,Pundit 1.1.0和Devise进行身份验证. 我正在尝试使用BlogController #Index操作的策略范围. >如果用户是管理员,则显示所有帖子(草稿,已发布) >如果用户是标准用户,则显示仅标记为已发布的帖子 >如果没有用户/用户未登录,则显示仅标记为已发布的帖子 得到错误: undefined method `
我正在使用Rails 3.2.2,使用aasm gem,我有这样的Document模型: class Document < ActiveRecord::Base include AASM aasm do state :unread, :initial => true state :read state :closed event :view do
我试图从IRB获取当前的 ruby版本,但它给了我这个错误: >> RUBY_VERSION NoMethodError: undefined method `write' for nil:NilClass from /usr/local/lib/ruby/1.9.1/irb.rb:311:in `printf' from /usr/local/lib/ruby/1.9.1/irb
我正在尝试覆盖ActiveAdmin控制器的索引操作,以显示current_user的结果而不是所有结果. controller do def index @user_tasks = UserTask.where(:user_id => current_user.id).page(params[:page]) end end 访问ActiveAdmin时,抛出异常: ActionV
当用户尝试更新其配置文件时,我的应用程序似乎随机地抛出“nil:NilClass”错误的“undefined方法”映射. 但是奇怪的是这是说错误发生在更新,但错误行实际上在一个视图中. 全错误: users#update (ActionView::TemplateError) "undefined method `map' for nil:NilClass" On line #52 of app
将OmniAuth gem更新为1.1后出现此错误: Started GET "/users/auth/facebook" for 127.0.0.1 at 2012-04-13 11:31:37 +0300 NoMethodError (undefined method `info' for nil:NilClass): omniauth (1.1.0) lib/omniauth/stra
我使用aws-sdk-core gem我在获取url表单aws时遇到错误 以下是我的代码 def initialize(bucket:, region:) @bucket = bucket client = Aws::S3::Client.new(region: region) @signer = Aws::S3::Presigner.new(client: client)
我正在使用Rails 3.2.0. 我有一个简单的模型,如下所示 class Favorite < ActiveRecord::Base validates :lst, :presence => true validates :uuid, :presence => true, :uniqueness => {:scope => :lst}