开发者

How would you implement a save and create another feature on a model in rails 3?

I'm trying to implement a save and create another instance of a开发者_开发百科 model but I can't understand how routing works.

def save_and_create
  @book_condition = BookCondition.new(params[:book])
  if @book_condition.save
    flash[:notice] = t('app.messages.success')
    redirect_to new_book_condition_url
  else
    render :action => 'new'
  end
end

Above is what I wrote. How would you do it? How would you route it?

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜