diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-04 00:49:38 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-08-04 00:49:38 -0500 |
commit | fa5726fba88ef6918d3652f9ad42f41cb5f5a575 (patch) | |
tree | e88d2bd8012efb2b76d2f449d77e3e304bcec8f5 /guides/source | |
parent | f6a735ea05279b838f79041647564b30f26565ce (diff) | |
download | rails-fa5726fba88ef6918d3652f9ad42f41cb5f5a575.tar.gz rails-fa5726fba88ef6918d3652f9ad42f41cb5f5a575.tar.bz2 rails-fa5726fba88ef6918d3652f9ad42f41cb5f5a575.zip |
Remove "Using Action View outside of Rails" section from AV overview guide
The section was clearly wrong and was just an example about how to use ActiveSupport helpers in Rack/Sinatra
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/action_view_overview.md | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index 3542844f33..6fce5a1dc2 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -1542,72 +1542,3 @@ end Then you could create special views like `app/views/posts/show.expert.html.erb` that would only be displayed to expert users. You can read more about the Rails Internationalization (I18n) API [here](i18n.html). - -Using Action View outside of Rails ----------------------------------- - -Action View is a Rails component, but it can also be used without Rails. We can demonstrate this by creating a small [Rack](http://rack.rubyforge.org/) application that includes Action View functionality. This may be useful, for example, if you'd like access to Action View's helpers in a Rack application. - -Let's start by ensuring that you have the Action Pack and Rack gems installed: - -```bash -$ gem install actionpack -$ gem install rack -``` - -Now we'll create a simple "Hello World" application that uses the `titleize` method provided by Active Support. - -**hello_world.rb:** - -```ruby -require 'active_support/core_ext/string/inflections' -require 'rack' - -def hello_world(env) - [200, {"Content-Type" => "text/html"}, "hello world".titleize] -end - -Rack::Handler::Mongrel.run method(:hello_world), Port: 4567 -``` - -We can see this all come together by starting up the application and then visiting `http://localhost:4567/` - -```bash -$ ruby hello_world.rb -``` - -TODO needs a screenshot? I have one - not sure where to put it. - -Notice how 'hello world' has been converted into 'Hello World' by the `titleize` helper method. - -Action View can also be used with [Sinatra](http://www.sinatrarb.com/) in the same way. - -Let's start by ensuring that you have the Action Pack and Sinatra gems installed: - -```bash -$ gem install actionpack -$ gem install sinatra -``` - -Now we'll create the same "Hello World" application in Sinatra. - -**hello_world.rb:** - -```ruby -require 'action_view' -require 'sinatra' - -get '/' do - erb 'hello world'.titleize -end -``` - -Then, we can run the application: - -```bash -$ ruby hello_world.rb -``` - -Once the application is running, you can see Sinatra and Action View working together by visiting `http://localhost:4567/` - -TODO needs a screenshot? I have one - not sure where to put it. |