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
Post a Comment