hashrocket / decent_exposure

A helper for creating declarative interfaces in controllers
MIT License
1.81k stars 107 forks source link

Rails 5 support: undefined local variable or method 'protected_instance_variables' for ActionController::Base:Class (NameError) #139

Closed rusllonrails closed 8 years ago

rusllonrails commented 8 years ago

Hey Guys,

Trying to use decent_exposure with Rails 5

Gemfile:

gem 'rails', '>= 5.0.0.beta2', '< 5.1'
gem 'decent_exposure'
gem 'decent_decoration'

On attempt to run any rake task I'm getting:

/home/alkapone/.rvm/gems/ruby-2.2.4@snyatcom/gems/decent_exposure-2.3.3/lib/decent_exposure/expose.rb:15:in `block in extended': undefined local variable or method `protected_instance_variables' for ActionController::Base:Class (NameError)
    from /home/alkapone/.rvm/gems/ruby-2.2.4@snyatcom/gems/decent_exposure-2.3.3/lib/decent_exposure/expose.rb:7:in `class_eval'
    from /home/alkapone/.rvm/gems/ruby-2.2.4@snyatcom/gems/decent_exposure-2.3.3/lib/decent_exposure/expose.rb:7:in `extended'
    from /home/alkapone/.rvm/gems/ruby-2.2.4@snyatcom/gems/decent_exposure-2.3.3/lib/decent_exposure.rb:5:in `extend'
    from /home/alkapone/.rvm/gems/ruby-2.2.4@snyatcom/gems/decent_exposure-2.3.3/lib/decent_exposure.rb:5:in `block in <top (required)>

Any solution on this?

Thanks :beers:

vnegrisolo commented 8 years ago

hey @rusllonrails, version 3 of this gem is working with rails 5.0.0.rc1. Will this work for you?

kalinchuk commented 5 years ago

Seeing this issue as well and not willing to upgrade to version 3 because it's missing a lot of the functionality that was available in version 2 (such as the ActiveRecord strategy)

mattpolito commented 5 years ago

@kalinchuk Can you elaborate on what you feel is missing from v3?

kalinchuk commented 5 years ago

@mattpolito I can no longer specify to use the DecentExposure::ActiveRecordStrategy strategy.

mattpolito commented 5 years ago

@kalinchuk Ah ok. Is there something custom you are doing in there or are you using the default AR strategy that came with DecentExposure? If default, it is no longer needed which is why it is not there anymore.

If you're doing something custom, I could probably help you through the transition.

kalinchuk commented 5 years ago

Got it. Thanks!