Displaying 2 results from an estimated 2 matches for "pictures_controller".
2006 Jan 31
3
Lost in routing
...'m trying to create a modules based system where my controllers are
all under modules. So the structure looks something like:
app/
controllers/
message/
news_controller.rb
email_controller.rb
library
books_controller.rb
pictures_controller.rb
home_page_controller.rb
Each of those controller has it''s own view, and there''s a central
application.rhtml for the layout. The layout has in it links to each
of the controllers using the form:
url_for(:controller => ''message/news'', :action => ...
2011 Apr 07
0
Refactor sorting of images
...an be sorted after ''liked'', and ''published''.
The show from an image has a next and prev button, so that you can
browse through the all images.
A picture has a next_picture and prev_picture method, so that it can
fetch it''s successor and predecessor.
## pictures_controller
def index
..
@pictures = Picture.where(:state => ''published'').paginate :page =>
params[:page], :per_page => per_page, :order => "#{sort_order.to_s}
DESC"
..
end
## pictures model
def prev_picture
prev_picture = self.class.where(sort_order.gte =>...