I'm getting the undefined method error when trying to run a search on Flickr using the Flickraw gem.
I'm quite new to Rails and have tried a few different methods but can't seem to get it to work.
Here is my application.html.erb,
<html>
<head>
<title>Workspace</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true%>
<%= csrf_meta_tags %>
</head>
<body>
<%= form_tag controller: "photos", action: "search", class: "navbar-form navbar-left", method: "get" do %>
<div class="form-group">
<%=text_field_tag :search, params[:text]%>
</div>
<%= submit_tag "Search", class: "btn btn-default" %>
<% end %>
<%= yield %>
</body>
</html>
Here is my PhotosController,
class PhotosController < ApplicationController
require "flickraw"
def index
@list = flickr.photos.getRecent
end
def search
@results = flickr.photos.search(params[:text => "text"])
end
end
I thought that by passing the text parameter it would return with a list of public photos related to the text input.
Any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire