【问题标题】:How can I get around NoMethodError with Vestal Versions on Rails 3.2 and Ruby 1.9.3?如何使用 Rails 3.2 和 Ruby 1.9.3 上的 Vestal 版本绕过 NoMethodError?
【发布时间】:2012-10-30 13:41:43
【问题描述】:

好的-我想我已经到处搜索了,我认为这应该是一个重复的问题,但是在查看并尝试了多种事情之后仍然没有基本的vestal_versions (1.2.2) 工作。我处于开发的早期阶段,因此我愿意接受其他实际适用于 Rails 3.2 和 Ruby 1.9.3 的版本控制解决方案。

repo 所有者正在寻找另一个冠军(也许这应该告诉我一些事情,呵呵),所以如果没有一些 TLC,也许这是不可能的,但如果有人弄清楚了,我将不胜感激。

感谢您的宝贵时间!

这是我的情况:

  • 最大操作系统 X 10.8.2
  • mac 端口:ruby 1.9.3p194(2012-04-20 修订版 35410)[x86_64-darwin11]
  • Rails 3.2.8

在我的 Gemfile 中

stuff...
gem 'mysql2'
gem 'vestal_versions', :git => 'git://github.com/laserlemon/vestal_versions.git'
more stuff...

bundle 告诉我我有: - 使用来自 git://github.com/laserlemon/vestal_versions.git 的vestal_versions (1.2.2)(在master)

我的模特:

class StoryPage < ActiveRecord::Base
  versioned

  belongs_to      :story

  attr_accessible :page_num, :title, :story_version, has_been_deleted, :content
end

来自我的控制器:

定义创建

    @story = current_user.stories.create(
      :name => params[:stories][:name] || 'New Story',
      :description => params[:stories][:description] || ''
    )

    # Add a blank page
    @story.story_pages.create(
        :title => 'New Page',
        :page_num => 1,
        :story_version => @story.version
    )
    @story.save

    respond_with(@story) do |format|
      format.html
      format.json
    end
  end

错误输出包含:

> DEPRECATION WARNING: The InstanceMethods module inside
> ActiveSupport::Concern will be no longer included automatically.
> Please define instance methods directly in VestalVersions::Changes
> instead. (called from include at
> /Users/leo_odonnell/.bundler/ruby/1.9.1/vestal_versions-6273df533f85/lib/vestal_versions.rb:109)
>     # and more like that, then
>     NoMethodError (undefined method `class_inheritable_accessor' for #<Class:0x007fa59e5c9400>):
>       app/models/story_page.rb:2:in `<class:StoryPage>'
>       app/models/story_page.rb:1:in `<top (required)>'
>       app/controllers/stories_controller.rb:22:in `create'

【问题讨论】:

    标签: ruby-on-rails-3.2 vestal-versions


    【解决方案1】:

    尝试:捆绑更新 rake

    此外,如果您遇到 MassAssignmentSecurity::Error 尝试此修复:https://github.com/laserlemon/vestal_versions/issues/86

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多