Rails: url_for должен быть доступен в изолированном классе, который должен быть создан - PullRequest
0 голосов
/ 15 мая 2010

Rails: url_for должен быть доступен в изолированном классе, который должен быть создан:

                    class ProfilePresenter < ActionController::Base

attr_reader :profile


def initialize(profile)
    super


    @a = url_for(:controller => 'profiles', :action => 'view', :profile_url => 'dd')
    @a

    @profile = profile
        end
     end

Как заставить url_for работать?я попытался расширить ActionController :: Base и ActionView :: Base, и я не могу: s

1 Ответ

0 голосов
/ 15 мая 2010

Я думаю, что вы должны включить "include ActionController :: UrlWriter"

Попробуйте выполнить

class ProfilePresenter < ActionController::Base
  include ActionController::UrlWriter
  attr_reader :profile


  def initialize(profile)
    super
    @a = url_for(:controller => 'profiles', :action => 'view', :profile_url => 'dd')
    @a
    @profile = profile
  end
end
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...