module BetterValidations::Object

Public Instance Methods

client_id() click to toggle source

Define a 'client_id' attribute for ActiveRecord::Base that can be used to identify objects in the error response.

# File lib/better_validations/object.rb, line 12
def client_id
  @client_id
end
client_id=(value) click to toggle source

A setter for 'client_id' attribute. Client can pass this attribute to API and fill it to identify objects in the error response.

# File lib/better_validations/object.rb, line 18
def client_id=(value)
  @client_id = value
end
detailed_errors_messages(wrap_attributes_to) click to toggle source

A helper method to get messages without a reference to 'errors'

# File lib/better_validations/object.rb, line 6
def detailed_errors_messages(wrap_attributes_to)
  errors.detailed_messages(wrap_attributes_to: wrap_attributes_to)
end
relation_for_nested_messages(relation) click to toggle source

Returns relation object for providing nested messages. By default it is the object itself.

# File lib/better_validations/object.rb, line 24
def relation_for_nested_messages(relation)
  public_send(relation)
end