Я использую драгоценные камни Devise и Netzke. Моя версия рельсов 3.1.1
Я хочу получить доступ к помощнику разработчика (current_user) в компоненте netzke.
Но это не в модели или представлениях. Это в rails_root / app / component / some_component.rb
Как я могу вызвать вспомогательный метод? Спасибо.
Вот мой код ....
# app/component/note_grid.rb
class NoteGrid < Netzke::Basepack::GridPanel
js_property :title, "Note"
model "Note"
def configuration
super.merge(
# I want to call helper method here.
:strong_default_attrs => {:user_id => current_user.id},
:columns => [{:name => :updated_at, :header => "Date - Time", :format => "d M Y - h:i A", :width => 200}, :description],
:add_form_config => {:items => [:description]},
:edit_form_config => {:items => [:description]}
)
end
end
В просмотрах
# app/views/main/index.html.erb
<%= netzke :main_container, :class_name => "NoteGrid" %>