ok I have been struggling with this - seems very straight forward? given a controller game_controller with a method/action receive_move that gets called by an ajax event on the client/browser I can ''automatically'' load an rjs file receive_move.rjs, but if I try to do this in code it always appends .rhtml to the file name? # the code that works but always loads the same rjs file # when called from receive_move action this loads up receive_move.rjs respond_to do |format| format.js end # this does not work # looking at the log it is appending .rhtml to the file name if standard_move then respond_to do |format| format.js { render :action => ''receive_move.rjs'' } end else respond_to do |format| format.js { render :action => ''receive_move_non_standard.rjs'' } end end found the above code on the net, maybe the approach is just plain wrong? Note that I can just code all of my rjs commands directly in the controller without issue? running rails ''1.2.3'' any help would be appreciated, Thanks! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/15/07, Jesse House <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > but if I try to do > this in code it always appends .rhtml to the file name?> # this does not work > # looking at the log it is appending .rhtml to the file name > if standard_move then > respond_to do |format| > format.js { render :action => ''receive_move.rjs'' } > end > else > respond_to do |format| > format.js { render :action => ''receive_move_non_standard.rjs'' } > end > endHave you tried leaving the ''.rjs'' off of your :action options? -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rick Denatale wrote:> Have you tried leaving the ''.rjs'' off of your :action options? > My blog on Ruby > http://talklikeaduck.denhaven2.com/yes, I tried both ways render :action => ''receive_move_non_standard.rjs'' tries to load receive_move_non_standard.rjs.rhtml and render :action => ''receive_move_non_standard'' tries to load receive_move_non_standard.rhtml and both ways generate a ActionController::MissingTemplate in the log with the file name it is trying to load -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try to create two new actions in controller: receive_move and receive_move_non_standard, and render them like render :action => :receive_move_non_standard -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Igor K. wrote:> Try to create two new actions in controller: receive_move and > receive_move_non_standard, and render them > like render :action => :receive_move_non_standardexcellent! that worked like a charm! Thanks Igor! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---