trufflep
trufflep

Reputation: 45

Can argument to Rail's before_filter be a method in another class?

For example in

class C
  before_filter X
  ...
end

Can X can somehow be specified to be a method in another (non-super) class?

I'm wondering if this is possible by just changing the argument to before_filter.

Upvotes: 0

Views: 56

Answers (1)

sameera207
sameera207

Reputation: 16629

I'm not sure why you want to call a class itself in a before filter, instead you could do this

class C
  before_filter :load_other_class_method
  ...

  load_other_class_method
    X.new_your_method #or loading your class
  end   


end

Upvotes: 1

Related Questions