Hi all Put the following code in a view of a Rails app (replace the model classes in the array with some of your model classes): <ul class="buttons"> <% [Country, LinkCategory, Link, Member, MusicArtist, MusicLabel, MusicStyle, PartySetting, PsyCommunity, OnlineShop, Session, SystemGroup, SystemRight].each do |clazz| %> <%= "<li" + ('' class="selected"'' if clazz.to_s.pluralize + "Controller" == self.controller.class.to_s) + ">" + clazz.to_s.tableize.titleize + "</li>" if user_authorized_to?(''VIEW'', clazz) %> <% end %> </ul> You''ll be surprised - you''ll get a TypeError. Now re-arrange the code to the following: <ul class="buttons"> <% [Country, LinkCategory, Link, Member, MusicArtist, MusicLabel, MusicStyle, PartySetting, PsyCommunity, OnlineShop, Session, SystemGroup, SystemRight].each do |clazz| %> <%= "<li" + ('' class="selected"'' if true) + ">" + clazz.to_s.tableize.titleize + " #{clazz.to_s.pluralize + "Controller" == self.controller.class.to_s}</li>" if user_authorized_to?(''VIEW'', clazz) %> <% end %> </ul> Now it works! Same code fragments, but different effect! What''s wrong here?! Very annoying... Thanks, Josh -- 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 -~----------~----~----~----~------~----~------~--~---