Skip to content

Instantly share code, notes, and snippets.

@sauy7
Created June 3, 2015 06:09
Show Gist options
  • Save sauy7/a281c76ffbf931c48690 to your computer and use it in GitHub Desktop.
Save sauy7/a281c76ffbf931c48690 to your computer and use it in GitHub Desktop.
Example using Devise's current_user with Trailblazer and Cells 4.0.0.beta5
# concepts/account/cell.rb
class Account::Cell < Cell:Concept
...
def show
render
end
class Grid < Cell::Concept
def show
concept('account/cell', collection: options[:current_user].accounts)
end
end
end
<%# views/accounts/index.html.erb %>
<%= concept("account/cell/grid", nil, current_user: current_user) %>
@sauy7
Copy link
Author

sauy7 commented Jun 3, 2015

This replaces:

class Grid < Cell::Concept
  include include Devise::Controllers::Helpers
  helper_method :current_user

  def show
    concept('account/cell', collection: current_user.accounts)
  end
end

as worked in beta3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment