title: Trying to use attr_accessor value in model in Rails 5
body: <p>I have a model where I create an attr_accessor:</p>
  
  <pre><code>attr_accessor :schedule_date
  </code></pre>
  
  <p>In my form I have a field:</p>
  
  <pre><code>&lt;%= f.text_field :schedule_date, label: 'Date', required: true %&gt;
  </code></pre>
  
  <p>And now after submitting the form I want to use this field in my model to make some calculation. </p>
  
  <p>The problem is that schedule_date is undefined in my model. Just to test it I am trying to raise an error with the value of the field:</p>
  
  <p>My model looks like this:</p>
  
  <pre><code>class Ride &lt; ApplicationRecord
    attr_accessor :schedule_date, :schedule_time
    raise schedule_date
  end
  </code></pre>
  
  <p>But when submitting the form I get:</p>
  
  <blockquote>
    <p>NoMethodError (undefined method `schedule_date'</p>
  </blockquote>
  
  <p>Why can't I use my attr_accessor value inside my model?</p>