title: Where to use attr_accessor in Rails?
body: <p>Why would you use <code>attr_accessor</code> in Rails?</p>
  
  <p>Documentation: <a href="http://apidock.com/ruby/Module/attr_accessor" rel="nofollow noreferrer">http://apidock.com/ruby/Module/attr_accessor</a></p>
  
  <p>My understanding is that it can be used to create "transient" variables that are not persisted in the db. And that it's a substitute for manually writing a setter and a getter. </p>
  
  <p>But I don't think other answer explain much more than above. Ie: <a href="https://stackoverflow.com/questions/5046831/why-use-rubys-attr-accessor-attr-reader-and-attr-writer">Why use Ruby&#39;s attr_accessor, attr_reader and attr_writer?</a></p>
  
  <p>So I'm still not sure in what situation I would actually use it. Can anyone elaborate?</p>