Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to use datamapper to return table entries as a json formatted string?
- Hash[Page.all( :fields => [:id, :title] ).map{|p|[p.id,p.title]}].to_json
- DEBUG (0.000176) SELECT `id`, `title` FROM `pages` ORDER BY `id`
- > {"1":"page A","2":"page B"}
- Page.all( :fields => [:title] ).map(&:title).to_json
- DEBUG (0.000038) SELECT `title` FROM `pages` ORDER BY `id`
- > ["page A","page B"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement