On 9 Nov 2008, at 20:19, Scott Kulik wrote:
> > I have a list of items in which some are locked. if they are locked > then I want to make them not be able to be edited. > > how can i set up something like this: > > before_filter :locked?(item), :only => [:edit, :update] > > def locked?(item) > if item.locked then return false > end Well you can't pass an argument to a filter like that. you'd have to fetch the item first (I presume this is all boilerplate stuff so you're interested in the one of id params[:id]. Also, returning false from a filter doesn't do anything any more - you need to render or redirect to halt the filter chain. Fred > > > or how should i be doing this? > > thanks! > -- > 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 -~----------~----~----~----~------~----~------~--~---

