In Rails 3, respond_to and format.all works differently than Rails 2?

后端 未结 3 664
栀梦
栀梦 2021-02-05 05:10

the code

respond_to do |format|
  format.html
  format.json { render :json => @switches }
  format.xml { render :xml => @switches.to_xml }
  format.all { r         


        
3条回答
  •  再見小時候
    2021-02-05 05:43

    You may find it useful to watch this episode of railscasts, which illustrates the changes to controllers in Rails 3 and in particular the changes to the responder class (putting respond_to in the controller class itself and only using respond_with @object in the action):

    http://railscasts.com/episodes/224-controllers-in-rails-3

提交回复
热议问题