Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DynamicPagesController < ApplicationController
- def map
- @fields = ['Software Engineering',
- 'Mechanical Engineering',
- 'Electrical Engineering',
- 'Aerospace Engineering',
- 'Civil Engineering',
- 'Chemical Engineering',
- 'Architectural Engineering']
- end
- end
- <%= select(:primary_field, :id, @fields) %>
- <%= button_to "Filter", map_path, :method => :get, class: "btn btn-primary" %>
- ...
- for (var i = 0; i < companies.length; i++){
- markers.addLayer(new L.Marker([companies[i].latitude, companies[i].longitude]).bindPopup(companies[i].popup, { maxHeight:150 }).openPopup());
- }
- if params[:filter].present?
- # This will apply the filter
- Model.where(attribute: params[:filter])
- else
- # This will return all records
- Model.all
- end
- select(:primary_field, :id, @fields, allow_blank: true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement