Its getting more complex than I thought.. May it will be easier to make 'can_de_*ted_by' methods as Class methods and call them directly bypassing the user model 'can_*t[e]' methods.
However this gives less control over the topics and items. I also have an index action, where in front of each topic name there edit/update/delete actions. Many users may have 'topic admin' role, however only the user who created particular topic should be able to delete it... Thanks, CS. Colin Law wrote: > 2009/3/11 Carlos Santana <[email protected]> > >> >> return true >> to pass this resource (item) as it has not been initialized. So how can >> I call method like: @currentuser.can_create?(item) from my show topic >> page. I am initializing resource objects within the controller, but how >> can I initialize these from my view? Do I need to? Any clues? >> >> > Are there different types of Topic? If not then can_create? does not > need to > be given a topic. Make can_be_created_by? a class method rather than an > instance method, so it is called by Topic.can_be_created_by?(user). > > Colin -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

