Examples for Template Contexts in Rango
-
-
Save reactormonk/303907 to your computer and use it in GitHub Desktop.
This file contains 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 Posts < Rango::Controller | |
include Rango::ExplicitRendering | |
def show | |
post = Post.get(params[:id]) | |
render "post.html", post: post | |
end | |
end |
This file contains 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 Posts < Rango::Controller | |
include Rango::ExplicitRendering | |
self.context ||= Object.new | |
def show | |
# you can't use @post explicitly | |
post = Post.get(params[:id]) | |
render "post.html", post: post | |
end | |
end |
This file contains 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 Posts < Rango::Controller | |
include Rango::ImplicitRendering | |
def show | |
@post = Post.get(params[:id]) | |
render "post.html" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment