0

I have a Devise User model with the following contents for which I did run migration.

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :token_authenticatable, :confirmable, :lockable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :role
  # attr_accessible :title, :body


  ROLES = ['admin', 'network/system admin', 'manager', 'programmer']

  def role?(base_role)
    ROLES.index(base_role.to_s) <= ROLES.index(role)
  end

end

later on , I added the below two lines to the same model and run migration for Ticket, Projects and Assignments.

  has_many :projects, :through => :assignments
  has_many :tickets

Does the above update the association of user with the Tickets and Projects? Is there any problem in changing associations in model after running migration for the same? I want to know it as I am developing a Rails app now.

Thanks :)-

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85

1 Answers1

0

You should also have association...

has_many :assignments

in your user model.

no other updation is required.

Ramiz Raja
  • 5,942
  • 3
  • 27
  • 39