Merge pull request #110 from pivotal-medici/fix_default_url_options

Return empty hash when url_options not provided
This commit is contained in:
José Valim 2012-08-07 10:22:05 -07:00
commit 655c4fe1c2
2 changed files with 7 additions and 1 deletions

View File

@ -449,7 +449,7 @@ module ActiveModel
end
def url_options
@options[:url_options]
@options[:url_options] || {}
end
# Returns a json representation of the serializable

View File

@ -143,6 +143,12 @@ class SerializerTest < ActiveModel::TestCase
assert_equal({ :host => "test.local" }, user_serializer.url_options)
end
def test_serializer_returns_empty_hash_without_url_options
user = User.new
user_serializer = UserSerializer.new(user)
assert_equal({}, user_serializer.url_options)
end
def test_pretty_accessors
user = User.new
user.superuser = true