Buttons's routing

Hey

My app has some buttons and i have route all to different action in router.rb file but click on each button results in same action. why?

Am i missing to specify anything…)

Rails:3.0.7

Thanks in advance.

Yes, obviously. Show us the code for a couple of the buttons. Have a look in the log to see what it says when you click the buttons. Post the relevant sections here if you cannot see what is wrong.

Colin

Hey

      My app has some buttons and i  have route all  to different action

in router.rb file but click on each button results in same action. why?

Am i missing to specify anything…)

Yes, obviously.

Show us the code for a couple of the buttons. Buttons are generted using following code

<%= button_to “Submit1”, :action => “click1”%>

<%= button_to “Submit2”, :action => “click2”%>

Similarly other buttons have been

created.obviously there are files in view directory with

name click1,click2 and so on.

Routing.rb file has following stuff

Check::Application.routes.draw do

get “posts/index”

resources :posts do

end

root :to => “posts#click1”

root :to => “posts#click2”

end

Thank you

I am sorry Amritpal (or John, if that is your name) I give up. You still seem to have not idea how routing works. I have advised on numerous occasions that you study the Rails Guide on routing and ask here if there is something you do not understand. You have never (as far as I recall) asked for clarification on any of the details in the guide so presumably you understand it all, yet you obviously have no idea.

Either you are winding us up or you need to seriously consider a different hobby (or career, but hopefully it is just a hobby).

Sorry again

Colin

Hey

      My app has some buttons and i  have route all  to different

action

in router.rb file but click on each button results in same action. why?

Am i missing to specify anything…)

Yes, obviously.

Show us the code for a couple of the buttons.

Buttons are generted using following code
  <%= button_to "Submit1", :action => "click1"%>
    <%= button_to "Submit2", :action => "click2"%>
                               Similarly other buttons have been
created.obviously there are files in view directory with
name click1,click2 and so on.

Routing.rb file has following stuff

Check::Application.routes.draw do

get “posts/index”

resources :posts do

end

root :to => “posts#click1”

root :to => “posts#click2”

end

I am sorry Amritpal (or John, if that is your name) I give up. You

still seem to have not idea how routing works. I have advised on

numerous occasions that you study the Rails Guide on routing and ask

here if there is something you do not understand. You have never (as

far as I recall) asked for clarification on any of the details in the

guide so presumably you understand it all, yet you obviously have no

idea.

Either you are winding us up or you need to seriously consider a

different hobby (or career, but hopefully it is just a hobby).

Sorry again

But sir this time i read the guides but didnt get solution to my problem.Thats why i asked here.

"root :to =>" is used to denote the HOME PAGE of your application.

Further, you're going against Rails convention if you really have actions like "click1" and "click2".

Please read through and understood Rails Routing properly.