开发者

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

开发者 https://www.devze.com 2023-03-09 18:20 出处:网络
I\'m trying to implement a save and create another instance of a开发者_开发百科 model but I can\'t understand how routing works.

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

精彩评论

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