ruby on rails - Re-routes using a method that should have nothing to do with it -


in view call upon controller method. seems call different method want do.

the view includes:

<%= link_to("upgrade account", upgrade_path) 

with routes:

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

'upgrade' not occur anywhere else in routes file.

the path in view should call upon following controller method:

  def upgrade     @organization = current_organization     @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 

this should render view (checkout.html.erb) has 2 forms. however, instead re-routes root message you're logged in. turns out message originates following controller method:

  def new_premium     if (logged_in_user?)       flash[:danger] = "you're logged in"       redirect_to root_url     end     @organization = organization.new     @member = @organization.members.build   end 

i don't see how method can come play , why code isn't working. have idea?

the controller contains def checkout don't see how might of effect. line render 'checkout' expect render checkout.html.erb , have no relationship either def checkout or def new_premium... right...?

look @ routes:

post 'signup/register'    => 'organizations#checkout',    as: 'signup_checkout' post 'signup/register'    => 'organizations#upgrade',     as: 'upgrade' 

the same url same verb used twice.

the rule in routing "first match first served", guess handled checkout.

fix simple, change url 1 of them.


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? -