When i click any button both respond to /app/view/posts/click.html.erb while i have another file work.html.erb in same directory for other button .Whats problem may be?
Hey
I am using rails 3.0.7.I created two buttons simply as:
<%= button_to "Great", :action => "click"%>
<%= button_to "click me", :action => "work"%>
Router.rb file looks like:
Check::Application.routes.draw do
# get "gne/clg"
get "posts/index"
resources :posts do
end
#get 'posts/click'
ActionController::Routing::Routes.draw do |map|
map.root :controller => "posts", :action => "click"
end
ActionController::Routing::Routes.draw do |map|
map.root :controller => "posts", :action => "work"
end
end
First off you don't need that ActionController::Routing::Routes.draw
stuff if you use the rails 3 syntax.
root :to => "posts#click"
Secondly you're mapping both your actions to the same path - you need
to map them to different paths if you want rails to know which action
to route to when the request arrives.
Third please stop posting the same question as two different people (John S Shelfer and Amritpal Pathak). Use one email address and one identity then wait for someone to respond.
I had not realised till just now that John Shelfer is also Amritpal
Pathak that has caused so much strain on our patience in the past. I
think he/she is a wind up merchant just getting us all to waste our
time.
Read it a couple of times at least. If you’re still unsure, at least you’ll have enough context to come back and ask specific questions about the parts you don’t understand.
Read it a couple of times at least. If you’re still unsure, at least you’ll have enough context to come back and ask specific questions about the parts you don’t understand.
It seems clear from posts recently that Amritpal Pathak and John
Shelfer are one and the same. He has been posting the same questions
under both names. Readers may find it interesting to read
where he posts under both aliases, thanking himself for support. It
is clear that the guy is not genuine.
I think you will have to get yourself a new name John/Amritpal
where he posts under both aliases, thanking himself for support. It
is clear that the guy is not genuine.
I only posted one question twice from both aliases.The reason was when i posted it from amrit aliase due to any network problem or something else ,it didn’t show at mailing list.So i was worried and posted it from other aliase too.
I apologize for it.Next time i will careful about it.
Can you explain then why in "uninitialized constant PostsController::Post" - Rails - Ruby-Forum
when I said "Am I the only one thinking this poster is winding us up?"
referring to yourself as Amrit that yourself as John replied " Not at
all.He is new to Rails So I think we should help him to resolve the
issue." and you as Amrit then replied again "Thank you for your
support sir".
Good effort. I'd forgotten about that thread (there were so many...)
It is clear that the guy is not genuine.
I don't think he's necessarily taking the p***, but he's certainly not
putting in the effort (or is not able to?) to work towards solving his
own problems. How many times have you and others said "rake routes"?
Remembering previous advice is essential to building skills, and
learning where to find stuff out for oneself (again... I've never seen
so many URLs pointing to the routing guides as have been in
Amritpal/John threads) means you don't have to keep wasting peoples'
time with the same questions.
when I said “Am I the only one thinking this poster is winding us up?”
referring to yourself as Amrit that yourself as John replied " Not at
all.He is new to Rails So I think we should help him to resolve the
issue." and you as Amrit then replied again "Thank you for your
support sir".
Yes .You are right colin.I did this mistake .I replied from both aliases here because i hadn’t want to create an issue(Guilt was mine ).So to terminate the thread i did it.NOw i ensure you ,it will not happen again.
I request to all of you please give me a chance to prove myself.
Thank you.
Use the troubleshooting skills that everyone has been teaching you. They’ve given you advice on how to check for why you can’t see that route and learn more about it. Demonstrate that you are learning from that advice. That is how you earn that chance.