Class: E9Tags::Rack::TagsJs
- Inherits:
-
Object
- Object
- E9Tags::Rack::TagsJs
- Defined in:
- lib/e9_tags/rack/tags_js.rb
Class Method Summary collapse
Class Method Details
.call(env) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/e9_tags/rack/tags_js.rb', line 3 def self.call(env) if env["PATH_INFO"] =~ /^\/js\/tags/ = ::Tagging.joins(:tag).order('tags.name').group_by(&:context).to_json js = "window.e9=window.e9||{};window.e9.tags=#{};" [200, {"Content-Type" => "text/javascript", "Cache-Control" => "max-age=3600, must-revalidate"}, [js]] else [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]] end end |