mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
17 lines
239 B
Ruby
17 lines
239 B
Ruby
class CustomReader
|
|
include ActiveModel::Validations
|
|
|
|
def initialize(data = {})
|
|
@data = data
|
|
end
|
|
|
|
def []=(key, value)
|
|
@data[key] = value
|
|
end
|
|
|
|
private
|
|
|
|
def read_attribute_for_validation(key)
|
|
@data[key]
|
|
end
|
|
end |