module Unpoly::Rails::Controller
This adds two methods `#up` and `#up?` to all controllers, helpers and views, allowing the server to inspect the current request for Unpoly-related concerns such as “is this a page fragment update?”.
Public Class Methods
prepended(base)
click to toggle source
# File lib/unpoly/rails/controller.rb, line 9 def self.prepended(base) base.helper_method :up, :up?, :unpoly, :unpoly? if base.respond_to?(:after_action) base.after_action { up.after_action } else base.after_filter { up.after_action } end end
Public Instance Methods
redirect_to(target, *args)
click to toggle source
TODO: Docs
Calls superclass method
# File lib/unpoly/rails/controller.rb, line 35 def redirect_to(target, *args) if up? target = url_for(target) target = up.url_with_field_values(target) end super(target, *args) end
up()
click to toggle source
TODO: Docs
# File lib/unpoly/rails/controller.rb, line 20 def up @up_change ||= Change.new(self) end
Also aliased as: unpoly
up?()
click to toggle source
Returns whether the current request is an [page fragment update](unpoly.com/up.replace) triggered by an Unpoly
frontend.
# File lib/unpoly/rails/controller.rb, line 31 delegate :up?, :unpoly?, to: :up