控制器组合
def create
@composition = Composition.new(params[:composition])
@lastProduct = Product.find(:last)
@productAsc = Product.order("updated_at ASC")
@lastProductUpdate = @productAsc.last
respond_to do |format|
if @composition.save
if self.new
format.html { redirect_to "/compositions/new" , notice: 'Composition was successfully created.' }
format.json { render json: @composition, status: :created, location: @composition }
end
if self.newCompo
format.html { redirect_to "/newCompo" , notice: 'Composition was successfully created.' }
format.json { render json: @composition, status: :created, location: @composition }
end
else
format.html { render action: "new" }
format.json { render json: @composition.errors, status: :unprocessable_entity }
end
end
错误:Missing template compositions/create, application/create with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "e:/rails_projects/Phebee/phebee_app/app/views"