Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Decorator method
def permissions_information_for_company(company)
init_haml_helpers
m = user.memberships.where(company_id: company.id).first
capture_haml do
haml_tag :div, {:class => "permissions_info"} do
haml_tag :h2 do
haml_concat "Permissions"
end
if m.permissions.present?
haml_concat "#{user.full_name} has the following permissions for company #{company.name}:"
haml_tag :ul do
m.permissions.each do |perm|
haml_tag :li do
haml_concat perm.to_s
end
end
end
else
haml_concat "#{user.full_name} currently doesn't have any permissions for company #{company.name}"
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.