Skip to content

Instantly share code, notes, and snippets.

@mh-github
Created June 1, 2017 19:18
Show Gist options
  • Select an option

  • Save mh-github/65f083297f44af689532ff71a67850f7 to your computer and use it in GitHub Desktop.

Select an option

Save mh-github/65f083297f44af689532ff71a67850f7 to your computer and use it in GitHub Desktop.
# controller code
@offers_grid = initialize_grid(Offer.where(employee_id: myself.id), include: [:customer, :employee])
# view code
<h1>Listing Offers</h1>
<%= grid(@offers_grid) do |g|
g.column name: 'Offer Id', attribute: 'offer_id', filter: false
if @cmd == true
g.column name: 'Sent By', attribute: 'name', assoc: :employee, custom_filter: @offer_senders
end
g.column name: 'Customer', attribute: 'name', assoc: :customer, custom_filter: :auto
g.column name: 'Date', attribute: 'updated_at', filter: false
g.column name: 'Price (INR)', attribute: 'charges', filter: false
g.column do |c|
link_to 'View / Edit', c
end
end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment