ruby on rails - Link does not pass on id correctly -


in view have included link:

<%= link_to("upgrade account", upgrade_path(@organization)) %> 

this link exists on standard 'show' view/page. visitor on example http://localhost/organizations/123 123 being @organization.id. there @organization defined.

in controller have:

  def upgrade     @organization = organization.find(params[:id])   # line doesn't work     @actioncode = actioncode.new     @amount = default_price     @currency = "eur"     @description = @organization.id     @transaction_description = "mydescription"     @transaction_type = "s"     @hash = hash(@description, @amount, @currency, @transaction_type)     render 'checkout'   end 

however, when click link in development in show view, error message below.

no route matches [get] "/signup/upgrade.123" 

does have idea going wrong? expect 'upgrade/123' if manually change address in browser's address bar 'upgrade/123' same.

in routes have:

  post 'signup/upgrade'     => 'organizations#upgrade',     as: 'upgrade'   'signup/organization' => 'organizations#new',         as: 'register'   'signup/register'     => 'organizations#new_premium', as: 'register_premium'   post 'signup/register'    => 'organizations#checkout',    as: 'signup_checkout'   'signup/confirmation' => 'organizations#confirmation' 

try updating route to

post 'signup/upgrade/:id' 

you can't test url browser's address bar because submit instead of post


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -