I've started to use Datamapper with Padrino and i have some weird issue. The issues is explained below:
1.The code:
content_type :json
@fonts = Font.all(:fields=>[:id,:name,:class_name])
@fonts.to_json
- Datamapper executes 3 queries and return me the all result with all fields.
Please see the sql queries that executed:
DEBUG - (0.000087) SELECT id, name, class_name FROM fonts ORDER BY id
DEBUG - (0.000205) SELECT id, post_script_name, designer, license, category, full_name, style, weight, filename, copyright, system_file_path, http_path, ext FROM fonts ORDER BY id
DEBUG - (0.000158) SELECT id, font_face FROM fonts ORDER BY id
Please help me with that Why it's happening ?
Thank you in advance!
The solution is: