Definitions
Sorry, no definitions found. Check out and contribute to the discussion of this word!
Etymologies
Sorry, no etymologies found.
Support
Help support Wordnik (and make this page ad-free) by adopting the word respond_to.
Examples
-
Post. find (params [: id]) @title = @post. title respond_to do | format | format. html # show. rhtml format. xml {render: xml = >
Recently Uploaded Slideshows midpoint 2009
-
It is always better to duck type and ask respond_to? than is_a?.
-
Restaurant. find_restaurants (request. query_parameters) [\ "restaurant\"] @restaurants [\ "item\"]. each do | item | bookmark = Bookmark. find_by_rcd item [\ "rcd\"] if bookmark 登録したブックマークを item [\ "memo\"] = bookmark. memo 食べログのレストランCDで検索 end end respond_to do
-
This is the vanilla provides / display example, but it has symmetry in respond_to as a class method, respond_with as a instance method, and the original respond_to blocks.
Planet Ruby on Rails 2009
-
I support the single-action, selective-render approach for the same reason I use respond_to instead of having separate actions for HTML and JS requests - sure, it might be verbose, but at least it's DRY.
Bruce Williams 2009
-
Yehuda has also been interested in improving the performance of respond_to / with by cutting down on the blocks needed.
Planet Ruby on Rails 2009
-
So it also feels progressive when you unpack the respond_with and transform it into a full respond_to if you suddenly need per-format differences.
Planet Ruby on Rails 2009
-
Merb has a feature related to Rails 'respond_to structure that works for the generic cases where you have a single object or collection that you want to respond with in different formats.
Planet Ruby on Rails 2009
-
The full respond_to structure when you needed to do things that didn't map to the generic structure, but still have the generic approach at hand when the circumstances were available for its use.
Planet Ruby on Rails 2009
-
The respond_to blocks are repeated for index, show, and often even edit.
Planet Ruby on Rails 2009
Comments
Log in or sign up to get involved in the conversation. It's quick and easy.