I want to use divs that resize based on the presence of certain ruby variables. How would I insert my size variable into a div like this <% @width = 30 %> <%"<div id=''inner_meal_pan_overview'' width=''100%'' style=\"width:#{@width}em;\">" %> -- 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 -~----------~----~----~----~------~----~------~--~---
> How would I insert my size variable into a div like this > > <% @width = 30 %> > > <%> "<div id=''inner_meal_pan_overview'' width=''100%'' > style=\"width:#{@width}em;\">" > %>that''s not absolutely wrong, only those slashes are not necessary if you use single parentheses: <%= "<div id=''inner_meal_pan_overview'' width=''100%'' style=''width:#{@width}em;''>" %> or: <div id=''inner_meal_pan_overview'' width=''100%'' style=''width:<%= @width %>em;''> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Also <% @width = 30 %> should really go in the controller action On Jul 9, 9:27 am, Thorsten Müller <thors...-1oxKqHKwyltBDgjK7y7TUQ@public.gmane.org> wrote:> > How would I insert my size variable into a div like this > > > <% @width = 30 %> > > > <%> > "<div id=''inner_meal_pan_overview'' width=''100%'' > > style=\"width:#{@width}em;\">" > > %> > > that''s not absolutely wrong, only those slashes are not necessary > if you use single parentheses: > <%= "<div id=''inner_meal_pan_overview'' width=''100%'' > style=''width:#{@width}em;''>" %> > > or: > <div id=''inner_meal_pan_overview'' width=''100%'' style=''width:<%= @width > %>em;''>--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---