RailsCasts Pro episodes are now free!

Learn more or hide this

Tom DeBerardine's Profile

GitHub User: Tomanow

Comments by Tom DeBerardine

Avatar

See my comment below for how to do this.

Avatar

To anyone trying to access instance variables from within the datatable controller, pass the instance variable to a method within a helper. For example:

ruby
# application_helper.rb
module ApplicationHelper
  def user_name
    @user.name
  end
end

# datatables/my_datatable.rb
class MyDatatable
   ...
   def hello_method
     "Hello, #{@view.user_name}"
   end
end