Created
December 27, 2010 15:32
-
-
Save hubertlepicki/756213 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 HelloWorldController < AbstractController::Base | |
include AbstractController::Rendering | |
include AbstractController::Layouts | |
include AbstractController::Helpers | |
include AbstractController::Translation | |
include AbstractController::AssetPaths | |
include ActionController::UrlWriter | |
# Uncomment if you want to use helpers defined in ApplicationHelper in your views | |
# helper ApplicationHelper | |
# Make sure your controller can find views | |
self.view_paths = "app/views" | |
# You can define custom helper methods to be used in views here | |
# helper_method :current_admin | |
# def current_admin; nil; end | |
def show | |
render template: "hello_world/show" | |
# or, for partials: | |
# render partial: "hello_world/show" | |
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
<h1>Hello, World!</h1> |
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
# From your model, observer or library, call: | |
HelloWorldController.new.show | |
# => "<h1>Hello, World!</h1>\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
any idea how to get this to work on Rails 3.2, specifically with proper digested asset urls? The above code doesn't work with rails 3.2