Method: FacetsController#create

Defined in:
app/controllers/facets_controller.rb

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/facets_controller.rb', line 7

def create
  @facet = Facet.new(params[:facet])
  @facet.catalog_id = @catalog.id
  if @facet.save
    flash[:notice] = "Facet was successfully created."
    redirect_to edit_catalog_facet_path(@catalog, @facet)
  else
    if params[:facet][:caption].blank?
      flash[:error] = "Facet could not be created! Caption cannot be empty!"
    else
      flash[:error] = "Facet could not be created!"
    end      
    redirect_to :back
  end
end