I have a simple search form which searches the index action of my articles controller. I have deployed my app to a sub URI and when i try searching, it redirects to domain.eu/articles
instead of domain.eu/app/articles
. I have made a symlink so every other page is working just fine under the sub URI, so im not sure why this isn't working?
thanks in advance!
my search form is as follows;
<%= form_tag("/articles", class: "navbar-search pull-left", method: :get) do %>
<%= text_field_tag :search, params[:search], class: "search-query span3", placeholder: "search for articles" %>
<% end %>
article.rb
def self.search(search)
if search
find(:all, conditions: ['title LIKE ?', "%#{search}%"])
else
find(:all)
end
end
Maybe because you put in a hard relative URL in here, and on the other places ruby generated urls? What happens if you replace it by "articles_path", which should be defined in your routes.rb?