Closed l3iodeez closed 9 years ago
for normal users custom_filter
should receive a hash with the options normal people can see, not :auto
Thanks. For anyone else with this issue simply iterate through the items in your controller and add them to a hash. Then set custom_filter: to that hash in your grid partial.
@ownedbuildings = Hash.new()
current_user.customer.buildings.each do |building|
@ownedbuildings[building.buildingname] = building.buildingname
end
this is ruby, not php. Use map
.
I have a wice_grid that displays information of the materials used in buildings belonging to customers in the view 'welcome'.
I have set up my controller so that the admin will see all buildings listed, but normal users only see buildings that belong to the Customer to which they belong. So far so good. The only problem is that normal users still see the names of all buildings in the custom filter dropdown for buildingname. I would like the dropdown to only display items that are owned by the customer to which the current user is attached.
Is there a way to do this in wice_grid? None of the examples seem to work this way.
welcome_controller .rb:
/views/welcome/_grid.html.erb - I have other fields but this is the only one for which I need to do this.