Skip to content

Instantly share code, notes, and snippets.

@mikebannister
Created September 26, 2011 04:38
Show Gist options
  • Save mikebannister/1241624 to your computer and use it in GitHub Desktop.
Save mikebannister/1241624 to your computer and use it in GitHub Desktop.
module Importable
module Validatable
extend ActiveSupport::Concern
included do
include ActiveModel::Validations
include ActiveModel::Serialization
attr_accessor :attributes
end
module InstanceMethod
def initialize(attributes = {})
@attributes = attributes
end
def read_attribute_for_validation(key)
@attributes[key]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment