ruby - Rails 3 - request.request_uri in model -


exist way have in own function in model request.request_uri?

now have in model called func.rb this:

class func    def self.url_adr      request.request_uri    end end 

but getting error undefined local variable or method `request' func:class

the request object available controllers. suppose pass in argument model if must, e.g.

##### in controller func.url_addr(request)  ##### in model def self.url_adr(controller_request)   controller_request.request_uri end 

however, ian has point, request data not associated models.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -