在轨道上重定向红宝石

时间:2013-06-07 13:21:45

标签: ruby-on-rails redirect

控制器组合

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"

0 个答案:

没有答案