Mention organization name while creating a conference

This commit is contained in:
shlok007 2017-08-13 02:31:46 +05:30 committed by Shlok Srivastava
parent c596a9fda7
commit 1a5aa14e2c
3 changed files with 7 additions and 3 deletions

View file

@ -72,11 +72,12 @@ module Admin
def new
@conference = Conference.new
@organizations = Organization.accessible_by(current_ability, :update).pluck(:name, :id)
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