Module: Divert
- Defined in:
- lib/divert.rb,
lib/divert/engine.rb,
lib/divert/version.rb,
lib/divert/configuration.rb,
app/models/divert/redirect.rb
Defined Under Namespace
Classes: Configuration, Engine, Redirect
Constant Summary collapse
- VERSION =
"0.9"
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
Instance Method Summary collapse
- #action_missing(path = nil) ⇒ Object (also: #divert)
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
7 8 9 |
# File 'lib/divert.rb', line 7 def configuration @configuration end |
Class Method Details
.configure {|configuration| ... } ⇒ Object
14 15 16 |
# File 'lib/divert.rb', line 14 def self.configure yield(configuration) end |
Instance Method Details
#action_missing(path = nil) ⇒ Object Also known as: divert
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/divert.rb', line 18 def action_missing path = nil controller = Divert.configuration.controller || controller_name path ||= params[:path] if action_methods.include? path send path and return end if template_exists?(path, [controller]) render "#{controller}/#{path}" and return end if Divert.configuration.save_to_db && (redirect = Redirect.hit(request.fullpath)) redirect_to redirect else unless template_exists? 'divert', [controller] render text:"Missing divert view: #{controller}/divert.html.erb", :status => 404 and return end render "#{controller}/divert", :status => 404 and return end end |