title: 'wrong number of arguments (given 1, expected 0)' following Ruby and Rails upgrade
body: <p>I built a Rails app with Ruby 2.4.0 and Rails 5.1.2 and it was working fine.</p>
  
  <p>I then upgraded Ruby to 2.5.5 and Rails to 5.2.3 (because Heroku demanded an upgrade) and when I click on a particular link I get the following error:</p>
  
  <pre><code>ArgumentError (wrong number of arguments (given 1, expected 0)):
  
  app/helpers/permissions_helper.rb:21:in `block in &lt;module:PermissionsHelper&gt;'
  app/helpers/permissions_helper.rb:60:in `instance_eval'
  app/helpers/permissions_helper.rb:60:in `block in permissions'
  app/helpers/permissions_helper.rb:60:in `select'
  app/helpers/permissions_helper.rb:60:in `permissions'
  app/controllers/models_controller.rb:66:in `validate_user'
  </code></pre>
  
  <p>permissions_helper.rb is as follows (lines 21 and 60 are marked with a comment):</p>
  
  <pre class="lang-rb prettyprint-override"><code>    module PermissionsHelper
  
        PERMISSIONS = {
          User =&gt; [
            {
              requirement: -&gt;{current_user.is_admin},
              actions: [:create, :read, :update, :destroy, :index, :update_all],
              rows: :all,
              cols: [:email, :username, :full_name]
            }
          ],
          ServiceGroup =&gt; [
            {
              requirement: -&gt;{current_user.is_admin},  #line 21
              actions: [:create, :read, :update, :destroy, :index, :update_all],
              rows: :all_not_deleted,
              cols: [:service_group, :description]
            }
          ],
          ServiceType =&gt; [
            {
              requirement: -&gt;{current_user.is_admin},
              actions: [:create, :read, :update, :destroy, :index, :update_all],
              rows: :all_not_deleted,
              cols: [:service_group_id, :service_type, :description]
            }
          ],
          Service =&gt; [
            {
              requirement: -&gt;{current_user.is_admin},
              actions: [:create, :read, :update, :destroy, :index, :update_all],
              rows: :all_not_deleted,
              cols: [:service_type_id, :duration, :price, :format, :is_active]
            }
          ]
        }
  
        def action_type(action=action_name.to_sym)
          {
            show: :read,
            edit: :update
          }[action] || action
        end
  
        # Returns an array of permitted subtables {rows: ?, cols: [...]} for current request
        def permissions(model,action)
          return [] if !PERMISSIONS[model]
          @permissions ||= {}; @permissions[model] ||= {};
          action = action_type(action)
          return @permissions[model][action] if @permissions[model][action]
          mc = self
          @permissions[model][action] = PERMISSIONS[model].
            select {|h| mc.instance_eval(&amp;h[:requirement]) &amp;&amp; (h[:actions].include? action)}.  #line 60
            map {|h| {rows: h[:rows], cols: h[:cols]}}
        end
  
        # Returns all permitted rows for given model, action, e.g., User.where(:all_not_deleted)
        def permitted_rows(model,action)
          sets = permissions(model,action).map{|h| h[:rows]}.uniq
          sets.inject(model.send(sets.shift)) do |acc,set|
            acc.or(model.send(set))
          end
        end
  
        def fields(obj, action)
          if obj.is_a? ActiveRecord::Relation
            (relation = obj; model = relation.klass)
          else
            (model = obj; relation = nil)
          end
          @fields ||= {}; @fields[obj] ||= {}
          @fields[obj][action] ||= permissions(model, action).inject({}) do |acc, perm|
            new_fields = perm[:cols] - (acc[:cols] || [])
            new_rows = [perm[:rows]] - (acc[:rows] || [])
            if new_fields
              if new_rows.empty? || perm[:rows] == :all_not_deleted || relation.nil? ||
              relation.send(perm[:rows]).count &gt; 0
                acc[:fields] = (acc[:fields] || []) + new_fields
                acc[:rows] = (acc[:rows] || []) + new_rows
              end
            end
            acc
          end [:fields]
        end
      end
  </code></pre>
  
  <p>The relevant code snippet from the ModelsController is as follows:</p>
  
  <pre class="lang-rb prettyprint-override"><code>    def validate_user
        @models = (params[:models] || [params[:model]]).map {|m| m.camelize.constantize}
        puts "permissions for #{@models[0]}:#{action_name} = #{permissions(@models[0], action_type)}". #line 66
        @models.each do |model|
          puts permissions(model, action_type)
          break (redirect_to root_url) unless permissions(model, action_type).any?
        end
      end
  </code></pre>
  
  <p>Why am I getting this error?</p>