RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: stchangg
Site: www.stchangg.com
Is there any significant performance penalty for calling object.class.validators_on(name).any? (below) for every field? Would it be measurably better to move this array retrieval to the form level?
object.class.validators_on(name).any?
def field_label(name, *args) options = args.extract_options! required = object.class.validators_on(name).any? { |v| v.kind_of? ActiveModel::Validations::PresenceValidator } label(name, options[:label], class: ("required" if required)) end
Also, the snap before the delegate refactoring was awesome. Thanks Ryan!
Just as UP4B LLC mentioned, rails g devise_views is deprecated. It's now rails g devise:views.
rails g devise_views
rails g devise:views
Source: (https://github.com/plataformatec/devise/issues/634)
Is there any significant performance penalty for calling
object.class.validators_on(name).any?
(below) for every field? Would it be measurably better to move this array retrieval to the form level?Also, the snap before the delegate refactoring was awesome. Thanks Ryan!
Just as UP4B LLC mentioned,
rails g devise_views
is deprecated. It's nowrails g devise:views
.Source: (https://github.com/plataformatec/devise/issues/634)