mardi 4 août 2015

Ruby on Rails: if current page? is homepage, don't show form

I want to not show a form, but only if current page is NOT the home page

This is what I have so far...

I have my route setup:

root 'projects#index'

My view:

<% if !current_page?(url_for(:controller => 'projects', :action => 'index')) %>
  show some stuff
<% end %>

This doesn't show if the url is localhost:3000/projects

But it shows if its localhost:3000

So I need to somehow make sure that if its the homepage, it won't show. Also, I have search parameters for the home page, and I still don't want to show if its like localhost:3000/projects?search=blahblahblah



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire