Two models with an association of have_one to have_many possible in Rails?

I am making a rails site where you can schedule an appointment for a service. Currently I have an Appointment and Client model. Now I have decided that in order to get the Client's information (name, email, etc) from an Appointment object, I would make an association between the two models. Now the way I see it, an Appointment should have_one client and a Client should have_many appointments. However, I have never seen an association between two model where they both have have_x associations. So what I am wondering is this is possible, will it work? Also is there a better way to do this, maybe something I'm missing? Any insight would be much appreciated!


I don't believe that will work. You may want to use the belongs_to method to associate your Appointment to your Client:

class Appointment < ActiveRecord::Base
  belongs_to :client

class Client < ActiveRecord::Base
  has_many :appointments

Need Your Help

Calling python from a c++ program for distribution

c++ python embedded-language

I would like to call python script files from my c++ program.

How to track which search results are displayed to users

web-analytics adobe-analytics

A client wants to track after a user searches for store location, which stores are displayed to the user. Is this something omniture can track? On the client's website, after filling out zip code and