app/models/programme.rb
def activate_on_create
    if User.current_user && !User.current_user.is_admin?
      self.is_activated = false
    else
      self.is_activated = true
    end
    true
  end
# callback, activates if current user is an admin or nil, otherwise it needs activating
callback, activates if current user is an admin or nil, otherwise it needs activating
callback activates if current user is an admin or nil otherwise it needs activating
def activate_on_create
    if User.current_user && !User.current_user.is_admin?
      self.is_activated = false
    else
      self.is_activated = true
    end
    true
  end
def activate_on_create if User . current_user && ! User . current_user . is_admin? self . is_activated = false else self . is_activated = true end true end
callback, activates if current user is an admin or nil, otherwise it needs activating
callback activates if current user is an admin or nil otherwise it needs activating