Rails: url_for to be available in a isolated class that must be instanced -


RAIL: URL_ should be available in a separate class, which should be instanced:

  Class profile viewer & lt; ActionController :: Base attr_reader: profile def initialize (profile) Super @ a = url_for (: controller => 'profiles',: verb = & gt; 'view',: profile_url = & gt; 'dd') @ a @profile = End of end of the profile  

How to work for the URL? I tried to expand ActionController :: Base and ActionView :: Base and I cant: s

. It seems that you have to include "Adding to ActionController :: UrlWriter"

Try the following

  class profile heading < ActionController :: ActionController :: UrlWriter attr_reader: profile def initialize (profile) in Base Super @ A = url_for (: Controller = & gt; 'Profile' ,: Action => 'view',: profile_url => Dd ') @ a = profile = profile ending  

Comments