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

Already on GitHub? Sign in to your account

module causing issues in Rails 3.0.x app #2

Closed
jeroenj opened this Issue Oct 24, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

jeroenj commented Oct 24, 2012

I have an old app which uses Rails 3.0.7 and the latest gem release (1.2) isn't loading in the app:

/Users/jeroen/.rvm/gems/ruby-1.8.7-p370@manchild/gems/activemodel-3.0.7/lib/active_model/validations/with.rb:70:in `validates_with': undefined method `new' for VatValidator:Module (NoMethodError)

A little digging seems to point out that the VatValidator module (and the include) are causing the error:

ActiveModel::Validations.__send__(:include, VatValidator)

A quick fix for me was to remove that line and move both the VatValidator and VatNumber classes out of the VatValidator module. Doing it like that the validator would load as expected.

I did not have the time yet to look further into it.

Contributor

jeroenj commented Oct 24, 2012

Example in this commit.

Owner

aurels commented Oct 25, 2012

Hello Jeroen,

I don't have time to look at this soon. I suppose you are using your fork now and it isn't blocking ?

Do you think it may cause issues with newer versions of Rails ?

Thanks ;-)

Owner

aurels commented Oct 25, 2012

BTW, does all the spec pass for you ?

"ViesCheckedInvoice should not be valid if the input is not valid" fails for me.

Contributor

jeroenj commented Oct 25, 2012

I'm currently using my fork, but I'm planning to do some testing soon to make a proper pull request.

The ViesCheckedInvoice fails for me too.

Contributor

jeroenj commented Oct 25, 2012

I just tested it in the example app and there it is working as expected. So it must have something to do with the app I am using it in. It might be because it's a spree-based app.

If I find some more time I'll investigate what's going wrong. I'd rather define it in a custom module and include it in ActiveModel::Validations like you did instead of having to open up those modules.

@jeroenj jeroenj closed this Oct 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment