Skip to content

Instantly share code, notes, and snippets.

@piclez
Created August 9, 2008 01:35
Show Gist options
  • Save piclez/4645 to your computer and use it in GitHub Desktop.
Save piclez/4645 to your computer and use it in GitHub Desktop.
MODEL:
class Gallery
include DataMapper::Resource
belongs_to :user
has n, :photos
def thumbnail
"1"
end
end
CONTROLLER:
def index
#@galleries = User.first(:login => params[:login]).galleries # This doesn't work! DM bug?
@galleries = Gallery.all # This works!
display @galleries
end
VIEW:
<%= partial 'galleries', :with => @galleries %>
PARTIAL:
<%= galleries.thumbnail %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment