El miércoles, 8 de marzo de 2017 14:51:51 (CET) Chee Chong Hwa escribió: > Hi Sergio > > Just saw your last suggestion on not using global variable. > > This works great ! > > def can_show_create_link > # if $level > 0 > if current_user.level > 0 > return true > else > return false > end > end
shorter version: def can_show_create_link current_user.level > 0 end Although I would use hide_create_link as method name because true means hidding create link. -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails Gem" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/activescaffold. For more options, visit https://groups.google.com/d/optout.
