I had developed one web application using scaffold...Application consists one controller(BOOKS). In BOOK controller 7 action are presented(new,create,show,edit,destroy,list,index)..correspondingly in views under BOOKS folder 4 rhtml files presented( new.rhtml,list.rhtml,show.rthml,edit.rhtml)..I can able to access all the actions(create,new,show..etc) presented in BOOKS controller from views(rhtml files)..But i could not able to access "create" action from other action(new,show,..etc) presented in BOOKS controller..i can able to access remaining actions from different action in BOOKS controller.. How to access "create" action from other action in BOOKS controller? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 15 March 2012 03:57, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I had developed one web application using scaffold...Application > consists one controller(BOOKS). In BOOK controller 7 action are > presented(new,create,show,edit,destroy,list,index)..correspondingly in > views under BOOKS folder 4 rhtml files presented( > new.rhtml,list.rhtml,show.rthml,edit.rhtml)..I can able to access all > the actions(create,new,show..etc) presented in BOOKS controller from > views(rhtml files)..But i could not able to access "create" action from > other action(new,show,..etc) presented in BOOKS controller..i can able > to access remaining actions from different action in BOOKS controller.. > How to access "create" action from other action in BOOKS controller?What do you mean you wan to access the create action from another action? Normally one does not access one action from another. Normally one would invoke an action from a view by including an appropriate link in the view. When asking questions about technical subjects it is necessary to be very careful with choice of words so that the question is understood. One way to ensure this is to give an example. I suggest that you work through some tutorials in order to understand the basics of rails. railstutorial.org is good and is free to use online (though you have to look for the link for free online use). Also have a look at the Rails Guides. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sorry for not be clear in MY question... i couldn''t able to transfer control to create action from another actions by using redirect_to method.. i can able to pass parameters from Web pages to create action by clicking create button. Example of my controller class LoginController < ApplicationController def new redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 end def create end def show end . . . def edit end end From new action i couldn''t able transfer control to redirect to create action. Example of Web page </html> <body> <form action="create"> <input type="text" name="parameter1"> <input type="Submit" value="Create"> </form> </body> </html> create action was able to access only by clicking "Create" button in Web page -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 16 March 2012 13:45, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: Please don''t top post, it makes it difficult to follow the thread. Insert your reply at appropriate points in previous message. Thanks.> Sorry for not be clear in MY question... > i couldn''t able to transfer control to create action from another > actions by using redirect_to method.. > i can able to pass parameters from Web pages to create action by > clicking create button. > > Example of my controller > > class LoginController < ApplicationController > def new > redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2You are still not being very clear, do you just mean that the line above does not work? It should be :action => ''create'' If it still is not right and you get an error show us the full error, if you don''t get an error but it does not seem to be working have a look in development.log to see what is going on.> end > def create > > end > def show > end > . > . > . > def edit > end > end > > From new action i couldn''t able transfer control to redirect to create > action. > > Example of Web page > > </html> > <body> > > <form action="create"> > <input type="text" name="parameter1"> > <input type="Submit" value="Create"> > > </form> > > </body> > </html> > create action was able to access only by clicking "Create" button in Web > pageI don''t understand why you have shown us the code above. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The code which you written, are correct. write code step by step and debug. Try to identify issues. See dovelopmet.log file, class LoginController < ApplicationController def new redirect_to :action=>create end def create raise "testing" end def show end . . . def edit end end run this code, added code one by one making sure previous written code are correct. http://guides.rubyonrails.org/layouts_and_rendering.html (2.3 Using redirect_to) http://guides.rubyonrails.org/routing.html (2.2 CRUD, Verbs, and Actions) read above section and try to understand how redirect_to and routers works. On 16/03/2012, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 16 March 2012 13:45, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Please don''t top post, it makes it difficult to follow the thread. > Insert your reply at appropriate points in previous message. Thanks. > >> Sorry for not be clear in MY question... >> i couldn''t able to transfer control to create action from another >> actions by using redirect_to method.. >> i can able to pass parameters from Web pages to create action by >> clicking create button. >> >> Example of my controller >> >> class LoginController < ApplicationController >> def new >> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 > > You are still not being very clear, do you just mean that the line > above does not work? It should be :action => ''create'' > > If it still is not right and you get an error show us the full error, > if you don''t get an error but it does not seem to be working have a > look in development.log to see what is going on. > >> end >> def create >> >> end >> def show >> end >> . >> . >> . >> def edit >> end >> end >> >> From new action i couldn''t able transfer control to redirect to create >> action. >> >> Example of Web page >> >> </html> >> <body> >> >> <form action="create"> >> <input type="text" name="parameter1"> >> <input type="Submit" value="Create"> >> >> </form> >> >> </body> >> </html> >> create action was able to access only by clicking "Create" button in Web >> page > > I don''t understand why you have shown us the code above. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote in post #1051854:> On 16 March 2012 13:45, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Please don''t top post, it makes it difficult to follow the thread. > Insert your reply at appropriate points in previous message. Thanks. > >> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 > You are still not being very clear, do you just mean that the line > above does not work? It should be :action => ''create'' > > If it still is not right and you get an error show us the full error, > if you don''t get an error but it does not seem to be working have a > look in development.log to see what is going on. > >> end >> <form action="create"> >> <input type="text" name="parameter1"> >> <input type="Submit" value="Create"> >> >> </form> >> >> </body> >> </html> >> create action was able to access only by clicking "Create" button in Web >> page > > I don''t understand why you have shown us the code above. > > Colin>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2this line does not working....when im redirecting to create action from new action...it does not invoking create action.. <form action="create">>> <input type="text" name="parameter1"> >> <input type="Submit" value="Create"> >> >> </form> >> >> </body> >> </html> >> create action was able to access only by clicking "Create" button in Web >> pagei had shown this to make clear my question..from Web page i can able to invoke the create action...but i couldn''t able to invoke the create action from some other action. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 19 March 2012 14:15, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1051854: >> On 16 March 2012 13:45, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your reply at appropriate points in previous message. Thanks. >> >>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 >> You are still not being very clear, do you just mean that the line >> above does not work? It should be :action => ''create'' >> >> If it still is not right and you get an error show us the full error, >> if you don''t get an error but it does not seem to be working have a >> look in development.log to see what is going on. >> >>> end >>> <form action="create"> >>> <input type="text" name="parameter1"> >>> <input type="Submit" value="Create"> >>> >>> </form> >>> >>> </body> >>> </html> >>> create action was able to access only by clicking "Create" button in Web >>> page >> >> I don''t understand why you have shown us the code above. >> >> Colin > > > >>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 > > this line does not working....when im redirecting to create action from > new action...it does not invoking create action..Did you not see my comment last time, It should be :action => ''create'' If it still does not work look in development.log and see what is happening. Also look at the Rails Guide on Debugging. That will show you ways of debugging your code. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Once take a look to this url http://guides.rubyonrails.org/layouts_and_rendering.html (2.3 Using redirect_to) Instead of redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 use redirect_to :action=>''create'' and in create method def create raise "testing" end it supposed to raise exception if not your router is not define properly. http://guides.rubyonrails.org/routing.html (2.2 CRUD, Verbs, and Actions) On 19/03/2012, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 19 March 2012 14:15, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> Colin Law wrote in post #1051854: >>> On 16 March 2012 13:45, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> >>> Please don''t top post, it makes it difficult to follow the thread. >>> Insert your reply at appropriate points in previous message. Thanks. >>> >>>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 >>> You are still not being very clear, do you just mean that the line >>> above does not work? It should be :action => ''create'' >>> >>> If it still is not right and you get an error show us the full error, >>> if you don''t get an error but it does not seem to be working have a >>> look in development.log to see what is going on. >>> >>>> end >>>> <form action="create"> >>>> <input type="text" name="parameter1"> >>>> <input type="Submit" value="Create"> >>>> >>>> </form> >>>> >>>> </body> >>>> </html> >>>> create action was able to access only by clicking "Create" button in Web >>>> page >>> >>> I don''t understand why you have shown us the code above. >>> >>> Colin >> >> >> >>>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 >> >> this line does not working....when im redirecting to create action from >> new action...it does not invoking create action.. > > Did you not see my comment last time, It should be :action => ''create'' > > If it still does not work look in development.log and see what is > happening. Also look at the Rails Guide on Debugging. That will show > you ways of debugging your code. > > Colin > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote in post #1052299:> On 19 March 2012 14:15, Mahes karthick <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> If it still is not right and you get an error show us the full error, >>>> </body> >>>> redirect_to :action=>create,:parameter1=>value1,:parameter2=>value2 >> >> this line does not working....when im redirecting to create action from >> new action...it does not invoking create action.. > > Did you not see my comment last time, It should be :action => ''create'' > > If it still does not work look in development.log and see what is > happening. Also look at the Rails Guide on Debugging. That will show > you ways of debugging your code. > > Colin:action => ''create''..i had given same code...but still i couldn''t able to invoke the create action..i will see development.log and debugging files. Thank you very much for your help.... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Pravin Mishra wrote in post #1052315:> Once take a look to this url > http://guides.rubyonrails.org/layouts_and_rendering.html > (2.3 Using redirect_to) > > Instead of redirect_to > :action=>create,:parameter1=>value1,:parameter2=>value2 > use redirect_to :action=>''create'' and in create method > > def create > raise "testing" > end > > it supposed to raise exception if not your router is not define > properly. > > http://guides.rubyonrails.org/routing.html > (2.2 CRUD, Verbs, and Actions)i will try this code and check it.. thanks for your guidelines... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.