I need to be able to write a controller method that does nothing to the view. That is, when the method in the controller terminates, I dont get an error in the browswer of: Template is missing Missing template blahbal/blahblah.erb in view path blah/views The termination of the controller I must write does nothing to the view (actually, I merely need to execute a little javascript, closing some divs, etc). Is there a way to do this? Thanks, Janna B
Do like this def my_method # DO whatever here render :nothing => true end Sandip On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressjanna-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> > I need to be able to write a controller method that does nothing to > the view. That is, when the method in the controller terminates, I > dont get an error in the browswer of: > > Template is missing > Missing template blahbal/blahblah.erb in view path blah/views > > The termination of the controller I must write does nothing to the > view (actually, I merely need to execute a little javascript, closing > some divs, etc). Is there a way to do this? Thanks, Janna B > > >-- Ruby on Rails Developer http://sandip.sosblog.com http://funonrails.wordpress.com www.joshsoftware.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 -~----------~----~----~----~------~----~------~--~---
That''s too easy! Oh, yeah....now I remember why I was turned on by Rails. Thanks! On Jun 4, 8:11 am, Sandip Ransing <san2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Do like this > > def my_method > # DO whatever here > render :nothing => true > end > > Sandip > > On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > I need to be able to write a controller method that does nothing to > > the view. That is, when the method in the controller terminates, I > > dont get an error in the browswer of: > > > Template is missing > > Missing template blahbal/blahblah.erb in view path blah/views > > > The termination of the controller I must write does nothing to the > > view (actually, I merely need to execute a little javascript, closing > > some divs, etc). Is there a way to do this? Thanks, Janna B > > -- > Ruby on Rails Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.joshsoftware.com
Actually...it DOES render nothing (as it says!). This just leaves me with a blank, white screen! I really need to have it DO nothing, and really RENDER nothing....just return from the controller''s method without doing anything different to the view. -Janna B On Jun 4, 8:11 am, Sandip Ransing <san2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Do like this > > def my_method > # DO whatever here > render :nothing => true > end > > Sandip > > On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > I need to be able to write a controller method that does nothing to > > the view. That is, when the method in the controller terminates, I > > dont get an error in the browswer of: > > > Template is missing > > Missing template blahbal/blahblah.erb in view path blah/views > > > The termination of the controller I must write does nothing to the > > view (actually, I merely need to execute a little javascript, closing > > some divs, etc). Is there a way to do this? Thanks, Janna B > > -- > Ruby on Rails Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.joshsoftware.com
On Jun 4, 2:16 pm, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> Actually...it DOES render nothing (as it says!). This just leaves me > with a blank, white screen! I really need to have it DO nothing, and > really RENDER nothing....just return from the controller''s method > without doing anything different to the view. -Janna B >I''m not entirely sure what you are after if render :nothing doesn''t fit. What are you expecting the http response to contain ? Fred> On Jun 4, 8:11 am, Sandip Ransing <san2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Do like this > > > def my_method > > # DO whatever here > > render :nothing => true > > end > > > Sandip > > > On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > > I need to be able to write a controller method that does nothing to > > > the view. That is, when the method in the controller terminates, I > > > dont get an error in the browswer of: > > > > Template is missing > > > Missing template blahbal/blahblah.erb in view path blah/views > > > > The termination of the controller I must write does nothing to the > > > view (actually, I merely need to execute a little javascript, closing > > > some divs, etc). Is there a way to do this? Thanks, Janna B > > > -- > > Ruby on Rails Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.joshsoftw...
I have a submit button on a form, which is in a div. When submitted, an email is sent, the div closes, all else remains the same in the view. Im just having a hard time in my mind fitting this into the Rails MVC paradigm here. How can I do this? -Janna On Jun 4, 9:39 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jun 4, 2:16 pm, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > Actually...it DOES render nothing (as it says!). This just leaves me > > with a blank, white screen! I really need to have it DO nothing, and > > really RENDER nothing....just return from the controller''s method > > without doing anything different to the view. -Janna B > > I''m not entirely sure what you are after if render :nothing doesn''t > fit. What are you expecting the http response to contain ? > > Fred > > > On Jun 4, 8:11 am, Sandip Ransing <san2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Do like this > > > > def my_method > > > # DO whatever here > > > render :nothing => true > > > end > > > > Sandip > > > > On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > > > I need to be able to write a controller method that does nothing to > > > > the view. That is, when the method in the controller terminates, I > > > > dont get an error in the browswer of: > > > > > Template is missing > > > > Missing template blahbal/blahblah.erb in view path blah/views > > > > > The termination of the controller I must write does nothing to the > > > > view (actually, I merely need to execute a little javascript, closing > > > > some divs, etc). Is there a way to do this? Thanks, Janna B > > > > -- > > > Ruby on Rails Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.joshsoftw...
On Jun 4, 2:44 pm, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> I have a submit button on a form, which is in a div. When submitted, > an email is sent, the div closes, all else remains the same in the > view. Im just having a hard time in my mind fitting this into the > Rails MVC paradigm here. How can I do this? -Janna >so you should be doing an ajax form submit that renders some javascript to close the div and so on. Fred> On Jun 4, 9:39 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > On Jun 4, 2:16 pm, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > > Actually...it DOES render nothing (as it says!). This just leaves me > > > with a blank, white screen! I really need to have it DO nothing, and > > > really RENDER nothing....just return from the controller''s method > > > without doing anything different to the view. -Janna B > > > I''m not entirely sure what you are after if render :nothing doesn''t > > fit. What are you expecting the http response to contain ? > > > Fred > > > > On Jun 4, 8:11 am, Sandip Ransing <san2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Do like this > > > > > def my_method > > > > # DO whatever here > > > > render :nothing => true > > > > end > > > > > Sandip > > > > > On Thu, Jun 4, 2009 at 5:31 PM, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote: > > > > > > I need to be able to write a controller method that does nothing to > > > > > the view. That is, when the method in the controller terminates, I > > > > > dont get an error in the browswer of: > > > > > > Template is missing > > > > > Missing template blahbal/blahblah.erb in view path blah/views > > > > > > The termination of the controller I must write does nothing to the > > > > > view (actually, I merely need to execute a little javascript, closing > > > > > some divs, etc). Is there a way to do this? Thanks, Janna B > > > > > -- > > > > Ruby on Rails Developerhttp://sandip.sosblog.comhttp://funonrails.wordpress.comwww.joshsoftw...
JannaB wrote:> I have a submit button on a form, which is in a div. When submitted, > an email is sent, the div closes, all else remains the same in the > view. Im just having a hard time in my mind fitting this into the > Rails MVC paradigm here. How can I do this? -Janna >I don''t think that is so much because of rails but because that is a consequence of submitting a form. However, you could investigate what Fred suggests or try <% form_remote_tag :update => ''dud'', :url => {:action => ''the action''} do%> I just tried this and nothing complains if you try to update a non-existent page element (''dud''), so that will work. The page with the form remains with nothing changed, but the controller does process the form. :) -- Posted via http://www.ruby-forum.com/.
On Jun 4, 3:34 pm, Mk 27 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > <% form_remote_tag :update => ''dud'', :url => {:action => ''the action''} > do%> > > I just tried this and nothing complains if you try to update a > non-existent page element (''dud''), so that will work. The page with the > form remains with nothing changed, but the controller does process the > form.You could even drop the :update option completely. Fred> > :) > -- > Posted viahttp://www.ruby-forum.com/.
On Thu, Jun 4, 2009 at 10:37 AM, Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > On Jun 4, 3:34 pm, Mk 27 <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> <% form_remote_tag :update => ''dud'', :url => {:action => ''the action''} >> do%> >> >> I just tried this and nothing complains if you try to update a >> non-existent page element (''dud''), so that will work. The page with the >> form remains with nothing changed, but the controller does process the >> form. > > You could even drop the :update option completely.Although, the OP actually said "The termination of the controller I must write does nothing to the view (actually, I merely need to execute a little javascript, closing some divs, etc). " Which seems self-contradictory, if you take view as being what the end-user sees. If there are divs to be closed, or whatever, DOM changes need to be effected. So I think one or more callbacks (:success, :failure, :complete) are needed to close/hide those divs, and perhaps some rendered javascript from the request if what needs to be done depends on server state as a result of the request. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale