title: How to pass arguments from Controller to a Model method in Ruby on Rails?
body: <p>I am including a custom method for formatting my json data. </p>
  
  <p>My controller looks like this:</p>
  
  <pre><code>("def" is taken out for brevity sake)
  
  respond_to do |format|
    format.json { render json: @user, :methods =&gt; [:follower_count(params[:id])] }
  end
  </code></pre>
  
  <p>My model looks like this:</p>
  
  <pre><code> def follower_count user_id
      User.find(user_id).friendships.count
    end
  </code></pre>
  
  <p>However, this throws a syntax error, unexpected '('.</p>
  
  <p>I'm not sure how to pass in an argument to the follower_count method in the controller. I tried wrapping in square – didn't work. I tried no brackets – still doesn't work. How do you pass in arguments?!</p>