Permalink
Browse files

Merge pull request #19055 from ianks/model_name.to_json

activemodel: make .model_name json encodable
  • Loading branch information...
rafaelfranca committed Feb 24, 2015
1 parent ac26bd1 commit 17bc8d2dbef0c74dbf09208d39726c1e73731679
@@ -129,7 +129,7 @@ class Name
#
# Equivalent to +to_s+.
delegate :==, :===, :<=>, :=~, :"!~", :eql?, :to_s,
:to_str, to: :name
:to_str, :as_json, to: :name
# Returns a new ActiveModel::Name instance. By default, the +namespace+
# and +name+ option will take the namespace and name of the given class
@@ -207,4 +207,8 @@ def @contact.as_json(options = {}); super(options.merge(only: [:name])); end
assert_no_match %r{"awesome":}, json
assert_no_match %r{"preferences":}, json
end
test "Class.model_name should be json encodable" do
assert_match %r{"Contact"}, Contact.model_name.to_json
end
end

0 comments on commit 17bc8d2

Please sign in to comment.