0

Devise と Netzke の gem を使用しています。私のレールのバージョンは 3.1.1 です

netzke コンポーネントでデバイス ヘルパー (current_user) にアクセスしたいです。

しかし、それはモデルやビューではありません。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" %>
4

1 に答える 1

1

を介して現在のユーザーインスタンスNetzke::Core.current_user にアクセスできます。netzkeコントローラーインスタンスにアクセスすることも役立ちます。これは、を介して行うことができます。Netzke::Core.controller

于 2011-11-08T11:34:24.363 に答える