Thursday, 15 July 2010

Rails Model field value -


I have a model named in Rail, whose name is a field by name_type_id RequestType itself is a model The expected values ​​of the request_type field for all objects in the Estimation class have been fixed (Medium, Low, High).

The RequestType model has an auto-generated ID and has the name as available field. I am planning to include three values, low, medium and high in the model and they have IDs 1,2 and 3. So are the following category designs correct?

  class RfsEstimation & lt; ActiveRecord :: Base_On: request_type  

Since RfsEstimation maintains foreign_for requestType, you Want to use the related_to union

  class RfsEstimation & lt; ActiveRecord :: Base is_to: request_type  

No comments:

Post a Comment