module Unpoly
Public Instance Methods
Returns whether the given CSS selector is targeted by the current fragment update for either a success or a failed response.
Note that the matching logic is very simplistic and does not actually know how your page layout is structured. It will return `true` if the tested selector and the requested CSS selector matches exactly, or if the requested selector is `body` or `html`.
Always returns `true` if the current request is not an Unpoly
fragment update.
# File lib/unpoly/rails/change.rb, line 130 def any_target?(tested_target) target?(tested_target) || fail_target?(tested_target) end
Returns whether the given CSS selector is targeted by the current fragment update in case of a failed response (non-200 status code).
Note that the matching logic is very simplistic and does not actually know how your page layout is structured. It will return `true` if the tested selector and the requested CSS selector matches exactly, or if the requested selector is `body` or `html`.
Always returns `true` if the current request is not an Unpoly
fragment update.
# File lib/unpoly/rails/change.rb, line 116 def fail_target?(tested_target) test_target(fail_target, tested_target) end
If the current form submission is a [validation](unpoly.com/input-up-validate), this returns the name attribute of the form field that has triggered the validation.
# File lib/unpoly/rails/change.rb, line 147 memoize def validate
Returns whether the current form submission should be [validated](unpoly.com/input-up-validate) (and not be saved to the database).
# File lib/unpoly/rails/change.rb, line 137 def validate? validate.present? end