title: How to invoke a method in controller?
body: <p>I had the following code in my create action.
  <strong>tasks_comtroller.rb</strong></p>
  
  <pre><code>def create
      @task = current_user.tasks.build(task_params)
      @task.complete = false
  
       n=1
        loop do
          unless Task.find_by priority: n
            @task.priority=n
            break
          end
          n+=1
        end
  
      respond_to do |format|
      if @task.save
        format.html { redirect_to user_tasks_path(current_user) }
        format.js
      else
        format.html { render action: 'new' }
        format.js
      end
     end
    end
  </code></pre>
  
  <p>Then I took out some part I made a method inside my task model.</p>
  
  <pre><code>class Task &lt; ActiveRecord::Base
  
   def priority_increment
       n=1
        loop do
          unless Task.find_by priority: n
            @task.priority=n
            break
          end
          n+=1
        end
    end
  end
  </code></pre>
  
  <p>How can I now correctly invoke this method from controller?</p>