Created
July 14, 2011 15:19
-
-
Save rks/1082651 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingsController < ApplicationController | |
respond_to :html, :json | |
before_filter { @thing = {one: 1, two: 2} } | |
# /things/a -> renders template at things/a.html.erb | |
# /things/a.json -> renders @thing.to_json | |
def a | |
respond_with @thing | |
end | |
# /things/b -> renders the template at b.html.erb | |
def b | |
do_some_stuff_with @thing | |
do_some_other_stuff | |
end | |
private | |
def do_some_stuff_with(something) | |
something[:three] = 3 | |
end | |
def do_some_other_stuff | |
# whatever... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment