Hi All, Hopefully it''s obvious what I''m trying to do here: respond_to do |format| format.html # show.html.erb format.fbml { render(:format=>''html'')} end The problem is, the fbml version doesn''t work. Rails insists on looking for show.fbml.erb and won''t just render show.html.erb. I''d rather not have to write this view twice. Any ideas on the syntax for this? Thanks! Tom --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Adam Cohen
2008-Mar-17 02:17 UTC
Re: Using respond_to to send multiple formats to the same view
On 3/16/08, Tom <tlianza-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi All, > > Hopefully it''s obvious what I''m trying to do here: > > respond_to do |format| > format.html # show.html.erb > format.fbml { render(:format=>''html'')} > end > > The problem is, the fbml version doesn''t work. Rails insists on > looking for show.fbml.erb and won''t just render show.html.erb. I''d > rather not have to write this view twice.unless someone has a better idea, you can use: format. fbml { render :template => ''my_model_view_dir/show'' } Adam --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg (Radar)
2008-Mar-17 02:35 UTC
Re: Using respond_to to send multiple formats to the same view
It was suggested in #rubyonrails this morning that you can do format.fbml { render .... , :mime_type => Mime::Type["text/html"] } On Mon, Mar 17, 2008 at 12:47 PM, Adam Cohen <ocdrails-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 3/16/08, Tom <tlianza-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hi All, > > > > Hopefully it''s obvious what I''m trying to do here: > > > > respond_to do |format| > > format.html # show.html.erb > > format.fbml { render(:format=>''html'')} > > end > > > > The problem is, the fbml version doesn''t work. Rails insists on > > looking for show.fbml.erb and won''t just render show.html.erb. I''d > > rather not have to write this view twice. > > > unless someone has a better idea, you can use: > format. fbml { render :template => ''my_model_view_dir/show'' } > > Adam > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sorry, I should have replied in #rubyonrails this morning but it took me a while to figure out that solution wouldn''t work. First of all the Mime::Type class doesn''t support [], and second of all I''m pretty sure that just controls the MIME type of the response, rather than selecting the format of the view (I could be wrong about that though). Adam''s suggestion (render(:template=>...)) with the full path worked great. Thank you Adam! Tom On Mar 16, 7:35 pm, "Ryan Bigg (Radar)" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> It was suggested in #rubyonrails this morning that you can do format.fbml { > render .... , :mime_type => Mime::Type["text/html"] } > > > > On Mon, Mar 17, 2008 at 12:47 PM, Adam Cohen <ocdra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On 3/16/08, Tom <tlia...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi All, > > > > Hopefully it''s obvious what I''m trying to do here: > > > > respond_to do |format| > > > format.html # show.html.erb > > > format.fbml { render(:format=>''html'')} > > > end > > > > The problem is, the fbml version doesn''t work. Rails insists on > > > looking for show.fbml.erb and won''t just render show.html.erb. I''d > > > rather not have to write this view twice. > > > unless someone has a better idea, you can use: > > format. fbml { render :template => ''my_model_view_dir/show'' } > > > Adam > > -- > Ryan Bigghttp://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---