ruby on rails - Routes only for selected group of Resource -


I have models of pages in my project. In this model, I have the following methods to recover the objects from the database: Where ('published_t & lt; =', Date.today) .where ('publication_end' = ('Publish' 'or' condition '= or publication_and & quot;

  def self.published Lt; = ', dated date,' unpublished ', date.)) Finally   

And my question is, to determine the route in the railroad tracks New possible that only published pages or so?

I do not know that I undestand you, but you might be somenthing like that:

  Resource: Get the 'publish' collection of pages unpublished 'end'   

In this way you will have pages / published and pages / unpublished routes.

If you want to see the page is 'published', you can do it in your show action:

  @page = Page.find (param [: Id]) if @Page.States! = 'Published' redirect_to .... end   

However, a better way to put the code above "Before filter"

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -