Screencast: Controller in Rails 3

In dieser Woche zeigt Ryan in seinem Screencast einige Details zu respond_with und wie eingebettete Flash Nachrichten und permanente Cookies in Rails 3 eingesetzt werden.

 

Download:

Download(20.3 MB, 10:49)
Alternativer Download für iPod & Apple TV(18.5 MB, 10:49)

 

Resourcen:

 

Quellcode:

# config/application.rb
config.filter_parameters += [:password]

# products_controller
redirect_to @product, :notice => "Successfully created product."
redirect_to [:edit, @product]
redirect_to [@category, :edit, @product]

cookies.permanent[:last_product_id] = @product.id

# in class
respond_to :html, :xml

# in action
respond_with(@products)
respond_with(@product, :location => products_url)
respond_with(@product, :responder => MyResponder)
respond_with(@product) do |format|
  format.xml { render :text => "I'm XML!" }
end

Eingestellt am 26.07.2010 um 14:51

Kategorie: Tutorials

Be Sociable, Share!

Kommentare für diesen Artikel wurden geschlossen.

Suchen auf rubyonrails.de

Aktuelle Rails Version + Abhängigkeiten:

Gem rails-3.0.0
actionmailer (= 3.0.0, runtime)
actionpack (= 3.0.0, runtime)
activerecord (= 3.0.0, runtime)
activeresource (= 3.0.0, runtime)
activesupport (= 3.0.0, runtime)
bundler (~> 1.0.0, runtime)
railties (= 3.0.0, runtime)

Rails auf Rubyforge
Rails auf Github