Skip to content

Instantly share code, notes, and snippets.

@cloudbring
Created March 3, 2016 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudbring/999dcdb18f47845d81df to your computer and use it in GitHub Desktop.
Save cloudbring/999dcdb18f47845d81df to your computer and use it in GitHub Desktop.
<%= 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