Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyama committed Nov 24, 2017
1 parent c21f0f0 commit 8356b86
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mobility/plugins/active_record/attribute_methods.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module Mobility
module Plugins
=begin
Module builder adding translated attributes to #attributes hash on model
instance. See {Mobility::Plugins::AttributeMethods} for further details.
=end
module ActiveRecord
module TranslatedAttributes
def translated_attributes
Expand Down
10 changes: 10 additions & 0 deletions lib/mobility/plugins/attribute_methods.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module Mobility
module Plugins
=begin
Adds translated attribute names and values to the hash returned by #attributes.
Also adds a method #translated_attributes with names and values of translated
attributes only.
@note Adding translated attributes to #attributes can have unexpected
consequences, since these values are not true attribute values.
=end
module AttributeMethods
class << self
# Applies attribute_methods plugin for a given option value.
Expand Down

0 comments on commit 8356b86

Please sign in to comment.