Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Associations in Rails

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 184
    Comment on it

    Associations makes common operations simpler and easy in code and removes unnecessary complexities.It ties objects together using foreign keys. Associations creates a connection between two models.
    here is the code which shows Association example:

    class Customer < ActiveRecord::Base
      has_many :orders, dependent: :destroy
    end
    
    class Order < ActiveRecord::Base
      belongs_to :customer
    end
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: