Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

ValidationErrors#to_json doesn't get declared if requirements are done in wrong order (e.g. via bundler) #15

@solnic

Description

@solnic

Title is pretty much explanatory. ActiveSupport overrides #to_json, leading to wrong json generated.

http://pastie.org/private/1mgbqwfskokwcs4htkccba

Notice how dm-validations is included after dm-serialize. Bundler doesn't know that dm-validations has some great stuff to be added from dm-serialize and thus can put their requires in any order.

I see some ways to fix this:

  1. Add #as_json method to ValidationErrors. It should be there anyways. This way, AS will still override #to_json, but will also properly encode your errors
  2. Ask yehuda to use some stable topological sort (I don't know if there is such a thing at all) thus making it possible to manually manage the requirement order
  3. Move #to_json / #as_json code to dm-validations instead of dm-serialization -- possibly causes the same problem but reversed

Created by mark - 2010-09-11 06:59:36 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1409

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions