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

Add Rails 4 compatibility #15

Closed
abitdodgy opened this Issue May 19, 2013 · 3 comments

Comments

Projects
None yet
2 participants

Upgrading to Rails 4 causes this error:

Mohamads-MacBook-Pro:printagram Mohamad$ rspec .
/Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/format.rb:46:in `check_options_validity': The provided regular expression is using multiline anchors (^ or $), which may present a security risk. Did you mean to use \A and \z, or forgot to add the :multiline => true option? (ArgumentError)
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/format.rb:20:in `check_validity!'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validator.rb:143:in `initialize'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/with.rb:87:in `new'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/with.rb:87:in `block in validates_with'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/with.rb:86:in `each'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/with.rb:86:in `validates_with'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/activemodel-4.0.0.rc1/lib/active_model/validations/format.rb:111:in `validates_format_of'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/pag_seguro-0.5.3/lib/pag_seguro/pre_approval.rb:19:in `<class:PreApproval>'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/pag_seguro-0.5.3/lib/pag_seguro/pre_approval.rb:2:in `<module:PagSeguro>'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/pag_seguro-0.5.3/lib/pag_seguro/pre_approval.rb:1:in `<top (required)>'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/pag_seguro-0.5.3/lib/pag_seguro.rb:24:in `require'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/pag_seguro-0.5.3/lib/pag_seguro.rb:24:in `<top (required)>'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `require'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `each'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `each'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-1.3.4/lib/bundler/runtime.rb:59:in `require'
    from /Users/Mohamad/.rvm/gems/ruby-1.9.3-p327/gems/bundler-
...

I believe this is related to this issue: rails/rails#6569

Line 22 of lib/pag_seguro/pre_aproval.rb

validates_format_of :day_of_year, with: /^\d{2}-\d{2}$/, if: :yearly?

Owner

teonimesic commented May 20, 2013

i fixed the regex with correct anchor tags. I did not test it further on a rails 4 app, so other problems could still arise. Try version 0.5.4 and see what happens!

I'll let you know how this goes. Thanks.

I think this issue can be closed. So far so good.

@abitdodgy abitdodgy closed this Jul 18, 2013

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