Skip to content

Commit 0152004

Browse files
committed
Documentation. Update documentation of field method
1 parent beaa718 commit 0152004

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/dynamoid/fields.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ module ClassMethods
128128
# user.age # => 21 - integer
129129
# user.age_before_type_cast # => '21' - string
130130
#
131+
# There is also an option +alias+ which allows to use another name for a
132+
# field:
133+
#
134+
# class User
135+
# include Dynamoid::Document
136+
#
137+
# field :firstName, :string, alias: :first_name
138+
# end
139+
#
140+
# user = User.new(firstName: 'Michael')
141+
# user.firstName # Michael
142+
# user.first_name # Michael
143+
#
131144
# @param name [Symbol] name of the field
132145
# @param type [Symbol] type of the field (optional)
133146
# @param options [Hash] any additional options for the field type (optional)

0 commit comments

Comments
 (0)