Skip to content

Commit

Permalink
re-add AbstractFormBuilder#object_model_name
Browse files Browse the repository at this point in the history
  • Loading branch information
ujifgc committed May 7, 2016
1 parent b86ebd8 commit 60da47a
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -182,6 +182,13 @@ def field_human_name(field)
I18n.translate("#{model_name}.attributes.#{field}", :count => 1, :default => field.to_s.humanize, :scope => :models)
end

##
# Returns the object's models name.
#
def object_model_name(explicit_object=object)
explicit_object.is_a?(Symbol) ? explicit_object : explicit_object.class.to_s.underscore.gsub(/\//, '_')
end

##
# Returns the name for the given field.
# field_name(:username) => "user[username]"
Expand Down

0 comments on commit 60da47a

Please sign in to comment.