On Mar 12, 2009, at 3:59 PM, Fresh Mix wrote:> In partial I have something like this:
>
> <% if @first == ''x'' %>
> xxx: <%= @data.xxx %>
> yyy: <%= @data.yyy %>
> <% else %>
> yyy: <%= @data.yyy %>
> xxx: <%= @data.xxx %>
> <% end %>
> zzz: <%= @data.zzz %>
> qqq: <%= @data.qqq %>
>
> Is there any better way to do this?
>
> I don''t like, that there are same lines 2 times.
> --
Controller says:
@order = [ ''xxx'', ''yyy'' ]
View:
<% @order.each do |a| %>
<%= a %>: <%= @data.send(a) %>
<% end %>
zzz: <%= @data.zzz %>
qqq: <%= @data.qqq %>
Or go all the way and:
@order = [''xxx'', ''yyy'',
''zzz'', ''qqq'']
-Rob
Rob Biedenharn http://agileconsultingllc.com
Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---