leikind / wice_grid

A Rails grid plugin to create grids with sorting, pagination, and (automatically generated) filters
MIT License
537 stars 213 forks source link

Possible incompatibility with 5.0.0.beta1 #272

Open koeckc opened 8 years ago

koeckc commented 8 years ago

Rails Version: Rails 5.0.0.beta1 Ruby Version: 2.3.0 Plugin Version: latest rails 3 Branch of the Plugin form Github Browserversion: Latest Chrome on OSX DB: Mysql 5.5

I would like to use your plugin in my Rails 5 Application .. is it possible ? I always get an exception when im trying to use ist.

Exception:

Completed 500 Internal Server Error in 24ms (ActiveRecord: 0.6ms)

ActionView::Template::Error (undefined method `merge!' for {"controller"=>"sites", "action"=>"index"}:ActionController::Parameters
Did you mean?  merge):
    <%= grid(@sites_grid) do |g|
       g.column do |task|
         task.id
       end
  app/views/sites/index.html.erb:27:in `_app_views_sites_index_html_erb__2067296923291537766_70147368119400'

Controller code:

def index
    @sites = Site.all
    @sites_grid = initialize_grid(Site)
end

View code:

<%= grid(@sites_grid) do |g|
  g.column do |site|
    site.id
  end
end -%>

I am suspecting the problem comes from the fact that rails5 params is not a hash anymore but an object. link http://eileencodes.com/posts/actioncontroller-parameters-now-returns-an-object-instead-of-a-hash/

Do you think your plugin is usable under rails5 already ?

Thx in advance constantin

leikind commented 8 years ago

I am suspecting the problem comes from the fact that rails5 params is not a hash anymore but an object.

Yes

Unfortunately I haven't been working on WiceGrid lately, and I don'y have any time to work on it now.

koeckc commented 8 years ago

Thx for the fast response

cfiorini commented 8 years ago

@leikind according to post on eileencodes.com I did a branch on my fork of wice_grid https://github.com/cfiorini/wice_grid/tree/rails5. What I did is not tested well but, IMHO, can be a start to have wice_grid running on Rails 5, best could be a branch rails5 so you can start to accept PR. BTW would be great to hear your opinions about ;)

leikind commented 8 years ago

I could definitely merge a commit which runs to_h on params :)

cfiorini commented 8 years ago

:) I will do other test and work about wice_grid on Rails 5 and when I feel confident about it I'll do a PR

leikind commented 8 years ago

ok 👍