HY!
我有Sinatra App:
class App < Sinatra::Base
before do
puts "do something..."
end
end
class OneController < App
before do
super() # Not work
puts "do something(App before filter) + more..."
end
end
所以,例如在 OneController 中,我需要在阻止之前运行应用,在阻止之前运行 OneController 。 请帮忙!我该怎么做?
super 关键字不起作用。
NoMethodError:super:没有超类方法`之前(?-mix :)&#39;
谢谢! (抱歉英语不好)
答案 0 :(得分:1)
您无需致电super
- before
是附加的 - 每次调用它都会添加到之前的通话中:
class OneController < App
before do
puts "do something(App before filter) + more..."
end
end