John Kopanas
2007-Nov-27 03:28 UTC
Best Practice/Design: respond_to in action with only one response type
Question, if at first my controller is only going to be responding with html templates to requests is it best practice to keep the respond_to block within each action? respond_to do |format| format.html end I find it adds a lot of noise to a controller for nothing. Correct me if I am wrong though please. Bonus question: why did we move from .rhtml to .html.erb? Are these the same for Rails or are they handled differently? Thanks everyone. -- John Kopanas john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org Blog: http://www.kopanas.com Conference: http://www.cusec.net Twits: http://www.twitter.com/kopanas --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan
2007-Nov-27 04:01 UTC
Re: Best Practice/Design: respond_to in action with only one response type
I would say no. To answer your bonus question... I could do html.builder Or js.erb Or rss.erb Or rss.builder. Much nicer to separate the language from the content type. On Nov 26, 2007 9:28 PM, John Kopanas <kopanas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Question, if at first my controller is only going to be responding > with html templates to requests is it best practice to keep the > respond_to block within each action? > > respond_to do |format| > format.html > end > > I find it adds a lot of noise to a controller for nothing. Correct me > if I am wrong though please. > > > Bonus question: why did we move from .rhtml to .html.erb? Are these > the same for Rails or are they handled differently? > > Thanks everyone. > > -- > John Kopanas > john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org > > Blog: http://www.kopanas.com > Conference: http://www.cusec.net > Twits: http://www.twitter.com/kopanas > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---