title: rails constructor "def initialize" with attributes: correct way to pass in model
body: <p>Hi I have a model called "Listing". 
  Here is the constructor for the model:</p>
  
  <pre><code>def initialize(business)
      puts 'inside Listing.initialize'
  
      @name = business.name
      @telephone = business.telephone
  
  
      puts 'Created a new Listing'
  end
  </code></pre>
  
  <p>I have a controller called "listings_controller"
  I have is another model called "Business". Inside the "listing_controller" I have a method in which I would like to instantiate a "Listing" with attributes of a "Business".</p>
  
  <p>Here is the code that does that in a "listings_controller"</p>
  
  <pre><code>def create_listings
  
      self.get_all  
      @businesses.each do |business|
       Listing.create(business)
  
      end
  
  end
  
  
  def show
  
     self.create_listings
     @listings = Listing.all
  
     respond_to do |format|
     format.html #show.html.erb
     end
  
  end
  </code></pre>
  
  <p>This initialization method is not working.Im getting this exception:</p>
  
  <pre><code>wrong number of arguments (2 for 1)
  </code></pre>
  
  <p>Rails.root: /Users/AM/Documents/RailsWS/cmdLineWS/Businesses</p>
  
  <p>Application Trace | Framework Trace | Full Trace
  app/models/listing.rb:53:in <code>initialize'
  app/controllers/listings_controller.rb:18:in</code>block in create_listings'
  app/controllers/listings_controller.rb:17:in <code>each'
  app/controllers/listings_controller.rb:17:in</code>create_listings'
  app/controllers/listings_controller.rb:26:in `show'</p>
  
  <p>How can I fix this?
  Thanks</p>