在rails中创建后如何将即时变量从控制器发送到方法?
如果我有这样的控制器:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_url
def set_url
@url = if request.url.include?("http://localhost:3000/")
"http://localhost:3000"
else
"http://tester.com"
end
end
end
我有这样的模型:
class Article < ActiveRecord::Base
after_create :get_url
def get_url
// how to get instant variable @url from before filter in application controller to this method ?
end
end
谢谢之前