On Tuesday, April 19, 2011 3:55:52 PM UTC-6, Ruby-Forum.com User wrote: > > Actually, all i wanted to do initially was this: > > def filter_scoper(scoper) > logger.info "The current class is #{self.class}" > #CategoriesController > > if params.has_key? :filter > send :"#{params[:filter]}_filter_scoper", scoper > elsif self.class.respond_to?(:blog_filter_scoper) > Do you mean: elsif self.respond_to?(:blog_filter_scoper) Note the lack of ".class" after self.
> send :"blog_filter_scoper" > else > scoper #call index_scoper > end > end > > Basically if the controller responds to blog_filter_scoper, then I want > to pass blog_filter_scoper as the model: > > def blog_filter_scoper > BlogPost > end > Yeah, looks like you're wanting to call an instance method as I pointed out above. > However, for some reason despite the fact that self.class outputs > CategoriesController and when I load the categories page, it does not > respond to the blog_filter_scoper method even though I defined > blog_filter_scoper method within the categories controller. > I don't know why this is happening. > It would appear to me that your immediate problem is the line of code I pointed out above. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.