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

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -