modify admin/conference_controller_spec and not authorized error messages

This commit is contained in:
shlok007 2017-06-14 20:42:50 +05:30
parent aa3df0243e
commit ad3d6f2f95
8 changed files with 120 additions and 105 deletions

View file

@ -72,11 +72,14 @@ module Admin
def new
@conference = Conference.new
@organizations = {}
Organization.all.each do |organization|
@organizations.store(organization.name, organization.id) if can? :create, Conference.new(organization: organization)
end
end
def create
@conference = Conference.new(conference_params)
@conference.organization = Organization.find_or_create_by(name: 'organization')
if @conference.save
# user that creates the conference becomes organizer of that conference
current_user.add_role :organizer, @conference