What Things We Can Define In The Model?

Technology CommunityCategory: Ruby on RailsWhat Things We Can Define In The Model?
VietMX Staff asked 3 years ago

There are lot of things you can define in models, the few are:

  1. Validations (like validates_presence_of, numeracility_of, format_of etc.)
  2. Relationships (like has_one, has_many, HABTM etc.)
  3. Callbacks (like before_save, after_save, before_create etc.)
  4. Suppose you installed a plugin say validation_group, So you can also define validation_group settings in your model
  5. ROR Queries in Sql
  6. Active record Associations Relationship