mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Add auto-stripping of question mark for attributes
This commit is contained in:
4
test/fixtures/poro.rb
vendored
4
test/fixtures/poro.rb
vendored
@@ -1,11 +1,13 @@
|
||||
class Model
|
||||
def initialize(hash={})
|
||||
def initialize(hash = {})
|
||||
@attributes = hash
|
||||
end
|
||||
|
||||
def read_attribute_for_serialization(name)
|
||||
if name == :id || name == 'id'
|
||||
object_id
|
||||
elsif respond_to?(name)
|
||||
send name
|
||||
else
|
||||
@attributes[name]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user