Frage

I'm new to RoR and I want to use Ransack on my project.

map_controller.rb:

def index
  @q = Tweet.order('id_tweet DESC').search(params[:q])
  @tweets = @q.result(distinct: true).page(params[:page]).per(5)
end

index.html.erb:

<%= search_form_for @q do |f| %>
  <%= f.text_field :text_cont, :value => 'Filter...' %>
  <%= f.submit "Src",:class => "btnSrc"%>
<% end %>

However, it does not work. Searching for "foo", I get this link:

http://0.0.0.0:3000/tweets?utf8=%E2%9C%93&q%5Btext_cont%5D=foo&commit=Src

And this:

Routing Error

No route matches [GET] "/tweets" Try running rake routes for more information on available routes.

What's happening? Anyone can help?

War es hilfreich?

Lösung

Solved.

Route problem, as imagined.

match '/tweets' => 'map#index'

This solved the problem.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top