Commit a399e900
Changed files (4)
app
controllers
api
views
api
v1
creations
app/controllers/api/v1/creations_controller.rb
@@ -5,7 +5,7 @@ module Api
respond_to :json
def index
- respond_with Creation.all
+ @creations = Creation.all.take(50)
end
private
app/views/api/v1/creations/index.json.jbuilder
@@ -0,0 +1,9 @@
+json.array! @creations do |creation|
+ json.name creation.name
+ json.user do
+ json.name creation.user.name
+ end
+ json.photos creation.photos do |photo|
+ json.url url_for(photo.image_url)
+ end
+end
Gemfile
@@ -22,6 +22,7 @@ gem 'dotenv-rails'
gem 'airbrake'
gem 'public_activity'
gem 'geocoder'
+gem 'jbuilder'
group :development, :test do
gem 'pg'
Gemfile.lock
@@ -164,6 +164,9 @@ GEM
rspec (>= 1.3.1)
selenium-webdriver (>= 0.1.3)
jasmine-core (1.3.1)
+ jbuilder (1.4.2)
+ activesupport (>= 3.0.0)
+ multi_json (>= 1.2.0)
journey (1.0.4)
jquery-fileupload-rails (0.4.1)
actionpack (>= 3.1)
@@ -327,6 +330,7 @@ DEPENDENCIES
formtastic
geocoder
jasmine
+ jbuilder
jquery-fileupload-rails
jquery-rails
kaminari