Hi Sergio

Thanks a million :-)
Also manage to to the same for the edit/delete actions

def authorized_for_delete?
     if current_user.level > 0
  false
     else 
  true 
     end  
  end
  def authorized_for_update?
     if current_user.level > 0
  false
else
       true  
end
  end


On Wednesday, 8 March 2017 22:10:52 UTC+8, Sergio Cambra wrote:
>
> 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.

Reply via email to