Created
June 23, 2019 16:37
-
-
Save marzdgzmn/149dfcdee71c0fc694159579963bfef3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//= require jquery | |
//= require jquery-ui | |
//= require rails-ujs | |
//= require activestorage | |
//= require turbolinks | |
//= require_tree . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_with url: admin_studies_edit_path, method: :get, local: true do |f| %> | |
<%= f.text_field :study_title, data: { autocomplete_source: admin_studies_path} %> | |
<%= f.submit 'Search', class: 'button-special' %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
return $('#study_title').autocomplete({ | |
source: $('#study_title').data('autocomplete-source') | |
}); | |
}(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
@studies = Study.search(params[:term]) | |
respond_to do |format| | |
format.html | |
format.json { render json: @studies.map(&:title) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment