New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5 support #193

Closed
fighterii opened this Issue Apr 4, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@fighterii
Copy link

fighterii commented Apr 4, 2016

Hey, i can't find any information on that, so i'll open this as new issue.

We are currently upgrading to rails 5, and encountered this issue, that godmin won't work with rails 5 at the moment.

First of all, the gemspec file specifies
gem.add_dependency "rails", "~> 4.0"
which excludes rails 5.

After i changed this by myself, to get my app working, godmin works and all the tests are passing, but there are some Deprecation warnings:
DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from require at /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/godmin-70dfa3ea6164/lib/godmin.rb:2)

@Linuus

This comment has been minimized.

Copy link
Member

Linuus commented Apr 4, 2016

Hi!

Yes, we haven't tested it with Rails 5 yet... Should probably do that soon! :)

Linus Pettersson

On mån 04 apr. 2016 at 08:32 fighterii

<
mailto:fighterii notifications@github.com

wrote:

Hey, i can't find any information on that, so i'll open this as new issue.

We are currently upgrading to rails 5, and encountered this issue, that godmin won't work with rails 5 at the moment.

First of all, the gemspec file specifies

gem.add_dependency "rails", "~> 4.0"

which excludes rails 5.

After i changed this by myself, to get my app working, godmin works and all the tests are passing, but there are some Deprecation warnings:

DEPRECATION WARNING: alias_method_chain is deprecated. Please, use Module#prepend instead. From module, you can access the original method using super. (called from require at /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/godmin-70dfa3ea6164/lib/godmin.rb:2)

You are receiving this because you are subscribed to this thread.

Reply to this email directly or
#193
#193

@fighterii

This comment has been minimized.

Copy link

fighterii commented Apr 4, 2016

Additional information:

besides the deprecation warnings on Rails 5 godmin won't work with the following error:
Generating a URL from non sanitized request parameters is insecure!

this happens both for manually trying to view a page and in my cucumber features

ArgumentError in Users#index

Showing /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/godmin-70dfa3ea6164/app/views/godmin/resource/_filters.html.erb where line #17 raised:

Generating a URL from non sanitized request parameters is insecure!

Extracted source (around line #176):

        when ActionController::Parameters
          unless options.permitted?
            raise ArgumentError.new("Generating a URL from non sanitized request parameters is insecure!")
          end
          route_name = options.delete :use_route
          _routes.url_for(options.to_h.symbolize_keys.

Trace of template inclusion: /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/godmin-70dfa3ea6164/app/views/godmin/resource/index.html.erb

Rails.root: /home/ubuntu/workspace
Application Trace | Framework Trace | Full Trace

actionpack (5.0.0.beta3) lib/action_dispatch/routing/url_for.rb:176:in `url_for'
actionview (5.0.0.beta3) lib/action_view/routing_url_for.rb:96:in `url_for'
...
@fighterii

This comment has been minimized.

Copy link

fighterii commented Apr 5, 2016

You can skip the error by adding
config.action_controller.permit_all_parameters = true to your config/application.rb , but this is obviously no good solution or recommended!

Furthermore the Buttons on the New and Edit Page Create User and Update User are now not correctly labeled, which causes some Cucumber Features to fail. On Rails 5 the buttons are labeled Update user / Create user , with a non-capitalized User. On Rails 4 this works and the buttons are correctly labeled with a capitalized User.

@adimasuhid

This comment has been minimized.

Copy link

adimasuhid commented Jul 4, 2016

Will also get fixed by updating the table helpers, though might not be the best solution:

# lib/godmin/helpers/tables.rb:18
link_to @resource_class.human_attribute_name(attribute.to_s), url_for(params.permit!.merge(order: "#{attribute}_#{direction}"))
@jensljungblad

This comment has been minimized.

Copy link
Collaborator

jensljungblad commented Jul 5, 2016

Will hopefully get around to fixing this next week if no one beats me to it

@jensljungblad jensljungblad referenced this issue Jul 11, 2016

Merged

Rails 5 support #199

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment