Created
March 3, 2016 02:30
-
-
Save cloudbring/999dcdb18f47845d81df to your computer and use it in GitHub Desktop.
This file contains hidden or 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_tag search_movies_path, :method => 'get', class: "navbar-form", role: "search" do %> | |
<%= text_field_tag :search, params[:search], class: "form-control" %> | |
<%= submit_tag "Search", name: nil, class: "btn btn-default" %> | |
# I needed a search method in the corresponding movies controller.rb | |
def search | |
@movies = Movie.search(params[:search]) | |
end | |
# Then I created a search view search.html.erb | |
class="row"> | |
<% @movies.each do |movie| %> | |
class="col-sm-6 col-md-3"> | |
class="thumbnail"> | |
<%= link_to (image_tag movie.image.url(:poster), class: 'image'), movie %> | |
</div> | |
<% end %> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment