Johnny Cash
Johnny Cash

Reputation: 5147

rails 4 routes constraints condition error

I have used Rails 3.0 with routes.rb it works well.But now,I upgraded Rails to 4.0 then this routes causes the No route matches [GET] "/project/12323/payment"

match "project/:id/payment" => "project#payment", :as => "project_payment", :via      => :get, :constraints => { :protocol => Rails.env.production? ? 'https' : 'http' }

If I remove :constraints => { :protocol => Rails.env.production? ? 'https' : 'http' }, again it works.I guess the problem is about :constraints syntax but I don't sure.

Do you know how can I fix it?

Upvotes: 1

Views: 636

Answers (2)

Debajit
Debajit

Reputation: 47111

Instead of 'https', say /https/

That worked for me.

Upvotes: 1

user167019
user167019

Reputation: 596

I was having the same problem. Trying changing https and http to https:// and http://, respectively.

Upvotes: 1

Related Questions