title: Ruby/Rails - How to Create a Class and Access it from the Controller
body: <p>I've been trying to use a few different gems for displaying googlemaps within rails 3 and have had several problems.</p>
  
  <p>Luckily I found this <a href="https://github.com/YouthTree/bhm-google-maps" rel="noreferrer">https://github.com/YouthTree/bhm-google-maps</a> which is a helper and it seems to work for others.</p>
  
  <p>I've installed it properly but in the readme <a href="https://github.com/YouthTree/bhm-google-maps/blob/master/README.md" rel="noreferrer">https://github.com/YouthTree/bhm-google-maps/blob/master/README.md</a>  it mentions creating a class for the object to display in the view.</p>
  
  <p>The example they gave was </p>
  
  <pre><code>class Location
     attr_accessor :address, :lat, :lng
     def initialize(address, lat, lng)
        @address = address
        @lat = lat
        @lng = lng
     end
    def to_s; address.to_s; end
  end
  </code></pre>
  
  <p>And then running </p>
  
  <pre><code> &lt;%= draw_map_of Location.new("My House", 12.345, 56.789) %&gt;
  </code></pre>
  
  <p>in the view.</p>
  
  <p>It seems simple enough but I haven't experienced the need of creating a class before in rails  so I have some questions.</p>
  
  <p>Should I create a location.rb file and place the above code in it, but where should I place the file? (model folder, application folder????)</p>
  
  <p>Is there a way for me to create this class within my controller?</p>
  
  <p>Ideally I would like to manipulate the lat/lng values as variables and display a dynamic map.</p>