title: Should I use class method or instance method, and why?
body: <p>In my Rails app, when creating a business I have a form that has the following field:</p>
  
  <pre><code>   &lt;%= check_box_tag(:default_company) %&gt; 
     &lt;%= label_tag(:default_company, "Set Company as Default") %&gt;
  </code></pre>
  
  <p>Essentially when I create a business, if they check this box, I need it to run something like the following code:</p>
  
  <pre><code>def set_default_company(company, user)
    exists = DefaultCompany.find(user.id)
    if exists
      exists.update_attributes(company: company)
    else  
      DefaultCompany.create(company: company, user: user)
    end
  end
  </code></pre>
  
  <p>While learning, I would usually do that stuff in my controller but i'm trying to follow best practices and use a fat model, skinny controller, so I'm wanting to use logic like this:</p>
  
  <pre><code>def create
    @company = Company.new(params[:company])
  
    if @company.save
      if params[:default_company]
        Company.set_default_company(@company.id, current_user.id,)
      end
      flash[:notice] = "Company was successfully created."
      redirect_to @company
    else
      redirect_to new_company_path
    end
  end
  </code></pre>
  
  <p>Here is where I am getting confused on whether to use a class method or an instance method, to call <code>set_default_company</code>. They both seem like they would work and I can't see a benefit to one or the other.</p>
  
  <p>In addition to giving me any information as to which method to use, if someone could show me a brief implementation of writing that as a class method vs. instance method it may give me a better understanding as to why.</p>
  
  <p>Here is how I would write them:</p>
  
  <pre><code>def self.set_default_company(company, user)
    # Logic here
  end
  
  def set_default_company(company, user)
    # Logic here
  end
  </code></pre>
  
  <p>Writing them that way I don't see a benefit to either.</p>