1

I use the wice_grid gem with the code below. This worked with Rails 4.2.6 but after updating to Rails 5.0.0 it gives the error "wrong number of arguments (given 0, expected 1)". Anyone got an idea how to solve this?

<%= grid(@acodes_grid, show_filters: :when_filtered, html: {class: 'my-grid'}) do |g|
  g.column name: 'ID', attribute: 'id', auto_reload: true, html: {id: 'grid-cells'}
  etc.
end %>

The associated controller method:

def index
  @acodes_grid = initialize_grid(Acode,
    include:         [:transactions],
    per_page:        25,
    order:           'acodes.code_exp_date',
    order_direction: 'desc')
end

Backtrace (don't think the merge! warning is related):

Processing by AcodesController#index as HTML
  User Load (0.9ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."username" ASC LIMIT $2  [["id", 101], ["LIMIT", 1]]
  Rendering acodes/index.html.erb within layouts/application
DEPRECATION WARNING: Method merge! is deprecated and will be removed in Rails 5.1, as `ActionController::Parameters` no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html (called from _app_views_acodes_index_html_erb__2623538288025501826_69831314588840 at /home/ubuntu/workspace/***/app/views/acodes/index.html.erb:9)
  Rendered acodes/index.html.erb within layouts/application (427.2ms)
Completed 500 Internal Server Error in 476ms (ActiveRecord: 4.2ms)

ActionView::Template::Error (wrong number of arguments (given 0, expected 1)):
     6: 
     7:       <div class="now1">Codes</div>
     8:       
     9:       <%= grid(@acodes_grid, show_filters: :when_filtered, html: {class: 'my-grid'}) do |g|
    10:         g.column name: 'ID', attribute: 'id', auto_reload: true, html: {id: 'grid-cells'}
    11:         g.column attribute: 'avatar', html: {id: 'grid-cells'} do |acode|
    12:           image_tag(acode.avatar.url, style: "max-height: 30px; max-width: 30px") if acode.avatar?

app/views/acodes/index.html.erb:9:in `_app_views_acodes_index_html_erb__2623538288025501826_69831314588840'
  Rendering /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
  Rendering /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (4.7ms)
  Rendering /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.8ms)
  Rendering /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.1ms)
  Rendered /usr/local/rvm/gems/ruby-2.3.1/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (86.6ms)
Marty
  • 2,132
  • 4
  • 21
  • 47

0 Answers0