Hi all, Any thoughts on this?
*Lucas Caton* @lucascaton <https://twitter.com/lucascaton> | lucascaton.com.br On Wed, 1 Feb 2017 at 18:40 Lucas Caton <[email protected]> wrote: Hi there, What about allowing to pass a proc to belongs_to's optional flag? So instead of the following: class Transaction < ApplicationRecord belongs_to :category, optional: true validates :category, presence: { message: :required }, if: :auto_created? end We could write: class Transaction < ApplicationRecord belongs_to :category, optional: ->(record) { record.auto_created? } end I'm happy to submit a PR if you agree with the suggestion. Cheers, Lucas. -- You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-core/V-padeQT7SQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.
