Module: Stall::CustomersHelper
- Defined in:
- app/helpers/stall/customers_helper.rb
Instance Method Summary collapse
- #current_stall_user ⇒ Object
- #stall_user_signed_in? ⇒ Boolean
-
#with_errors_from_user(customer) ⇒ Object
Copy e-mail error messages from user to customer, allowing them to be displayed in customer e-mail input to the visitor.
Instance Method Details
#current_stall_user ⇒ Object
7 8 9 10 11 |
# File 'app/helpers/stall/customers_helper.rb', line 7 def current_stall_user if (method = Stall.config.default_user_helper_method) && respond_to?(method, true) send(Stall.config.default_user_helper_method) end end |
#stall_user_signed_in? ⇒ Boolean
3 4 5 |
# File 'app/helpers/stall/customers_helper.rb', line 3 def stall_user_signed_in? !!current_stall_user end |
#with_errors_from_user(customer) ⇒ Object
Copy e-mail error messages from user to customer, allowing them to be displayed in customer e-mail input to the visitor
16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/stall/customers_helper.rb', line 16 def with_errors_from_user(customer) return customer unless (user = customer.user) && user.errors.any? return unless ( = user.errors.[:email]) && .any? .each do || customer.errors.add(:email, ) end customer end |