mercredi 6 septembre 2017

Replace the Role_requirement plugin with a gem and fix the issue with class_inheritable_array

We Have a project working in Rails 3.1.16 and ruby 1.9.3. We are planning to upgrade the rails version to 3.2. The issue we have encountered is when we update the Gemfile with

gem 'rails', '3.2.6' 

and do the bundle install. and every thing works perfects . only the

DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://ift.tt/wl0LFP. (called from at /home/*****/********/config/environment.rb:6)

when we tries to do the localhost:3000 gets the below error,

Started GET "/" for 127.0.0.1 at 2017-09-06 11:59:02 +0530

ActionController::RoutingError - undefined method `class_inheritable_array' for ApplicationController:Class:

when i take the ApplicationController,

it contains a

require File.join(Rails.root, 'lib', 'role_requirement_system.rb')
  include RoleRequirementSystem

also when navigate to the RoleRequirementSystem file, it shows the

module RoleRequirementSystem
  def self.included(klass)
    klass.send :class_inheritable_array, :role_requirements
    klass.send :include, RoleSecurityInstanceMethods
    klass.send :extend, RoleSecurityClassMethods
    klass.send :helper_method, :url_options_authenticate? 

    klass.send :role_requirements=, []

  end

class_inheritable_array is the issue we think, the reason is there in active_support. when I tried in the rails 3.1.16, it shows some code definition in the active_support, and when I moved to the 3.2.6, there is no code definition.Is this my error when upgrading the Rails version?. TIA

Aucun commentaire:

Enregistrer un commentaire