【发布时间】:2012-07-09 09:41:59
【问题描述】:
我只是希望以随机顺序返回 DataMapper 记录。
这是我的模型(使用带有 sqlite3 数据库的 DataMapper):
class Movie
include DataMapper::Resource
DataMapper::Property::String.length(255)
property :id, Serial
property :title, String
property :img, String
property :description, String
property :year, String
property :created_at, DateTime
has n, :votes
belongs_to :user
end
这就是我返回记录的方式(Sinatra)
get '/' do
@movies = Movie.all # <-- What should this look like?
haml :home
end
【问题讨论】:
标签: ruby sqlite sinatra datamapper