Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEmbed::Formatter::JSON.backend::ParseError is nil #11

Open
panzi opened this issue May 18, 2011 · 1 comment
Open

OEmbed::Formatter::JSON.backend::ParseError is nil #11

panzi opened this issue May 18, 2011 · 1 comment
Labels

Comments

@panzi
Copy link

panzi commented May 18, 2011

For some reason ::ActiveSupport::JSON.parse_error is nil at the point where it is assigned to OEmbed::Formatter::JSON.backend::ParseError and thus you get strange exceptions later. I use Rails 2.3.

Maybe it would be better to change it to a method that reads ::ActiveSupport::JSON.parse_error whenever it is called?

Currently I fix this by adding this initializer:
module OEmbed
module Formatter
module JSON
module Backends
module ActiveSupportJSON
if ParseError.nil?
remove_const(:ParseError)
if ::ActiveSupport::JSON.parse_error.nil?
ParseError = StandardError
else
ParseError = ::ActiveSupport::JSON.parse_error
end
end
end
end
end
end
end

@metavida
Copy link
Collaborator

Interesting. Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants