9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/spree/admin/locations_controller.rb', line 9
def create
if location_exist?
flash[:error] = I18n.t('location.already_exist')
render :new, status: :unprocessable_entity and return
end
location = model_class.new(permitted_resource_params)
if location.save
flash[:success] = flash_message_for(location, :successfully_created)
redirect_to spree.admin_locations_path
else
flash.now[:error] = location.errors.full_messages.to_sentence
render :new, status: :unprocessable_entity
end
end
|