Commit fdfaf54b

mo khan <mo@mokhan.ca>
2014-12-21 01:18:12
install latest delayed job and remove dependence on responders gem.
1 parent a2fb03f
app/controllers/api/v1/cakes_controller.rb
@@ -1,14 +1,12 @@
 module Api
   module V1
     class CakesController < ApiController
-      respond_to :json
-
       def index
-        respond_with(@cakes = current_user.creations)
+        @cakes = current_user.creations
       end
 
       def show
-        respond_with(@cake = current_user.creations.find(params[:id]))
+        @cake = current_user.creations.find(params[:id])
       end
 
       def create
@@ -16,27 +14,26 @@ module Api
       end
 
       def create_cake_succeeded(cake)
-        respond_with(@cake = cake)
+        @cake = cake
       end
 
       def create_cake_failed(cake)
-        respond_with(@cake = cake)
+        @cake = cake
       end
 
       def update
         @cake = current_user.creations.find(params[:id])
         current_user.tag(@cake, with: params[:cake][:tags], on: :tags)
         if @cake.update(cake_params.reject { |key, value| key == "tags" })
-          respond_with @cake
+          @cake
         else
-          respond_with @cake
+          @cake
         end
       end
 
       def destroy
         @cake = current_user.creations.find(params[:id])
         @cake.destroy!
-        respond_with(@cake)
       end
 
       private
app/controllers/sitemap_controller.rb
@@ -1,6 +1,5 @@
 class SitemapController < ApplicationController
   layout nil
-  respond_to :xml
 
   def index
     @creations = Creation.all
db/schema.rb
@@ -17,40 +17,40 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   enable_extension "plpgsql"
   enable_extension "uuid-ossp"
 
-  create_table "activities", force: true do |t|
-    t.integer  "subject_id",   null: false
-    t.string   "subject_type", null: false
-    t.integer  "user_id",      null: false
-    t.datetime "created_at",   null: false
-    t.datetime "updated_at",   null: false
+  create_table "activities", force: :cascade do |t|
+    t.integer  "subject_id",               null: false
+    t.string   "subject_type", limit: 255, null: false
+    t.integer  "user_id",                  null: false
+    t.datetime "created_at",               null: false
+    t.datetime "updated_at",               null: false
   end
 
   add_index "activities", ["subject_id"], name: "index_activities_on_subject_id", using: :btree
   add_index "activities", ["subject_type"], name: "index_activities_on_subject_type", using: :btree
   add_index "activities", ["user_id"], name: "index_activities_on_user_id", using: :btree
 
-  create_table "avatars", force: true do |t|
+  create_table "avatars", force: :cascade do |t|
     t.integer  "user_id"
-    t.datetime "created_at",        null: false
-    t.datetime "updated_at",        null: false
-    t.string   "avatar"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "avatar",            limit: 255
     t.boolean  "avatar_processing"
-    t.string   "avatar_tmp"
+    t.string   "avatar_tmp",        limit: 255
   end
 
   add_index "avatars", ["user_id"], name: "index_avatars_on_user_id", using: :btree
 
-  create_table "categories", force: true do |t|
-    t.string   "name"
+  create_table "categories", force: :cascade do |t|
+    t.string   "name",       limit: 255
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.string   "slug"
+    t.string   "slug",       limit: 255
   end
 
-  create_table "comments", force: true do |t|
+  create_table "comments", force: :cascade do |t|
     t.integer  "user_id"
     t.integer  "creation_id"
-    t.string   "text"
+    t.string   "text",        limit: 255
     t.integer  "disqus_id"
     t.datetime "created_at"
     t.datetime "updated_at"
@@ -59,39 +59,39 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "comments", ["creation_id"], name: "index_comments_on_creation_id", using: :btree
   add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree
 
-  create_table "creations", force: true do |t|
-    t.string   "name"
+  create_table "creations", force: :cascade do |t|
+    t.string   "name",            limit: 255
     t.text     "story"
     t.datetime "created_at"
     t.datetime "updated_at"
     t.integer  "user_id"
-    t.string   "image"
-    t.string   "watermark"
-    t.integer  "photos_count",    default: 0
-    t.integer  "favorites_count", default: 0
+    t.string   "image",           limit: 255
+    t.string   "watermark",       limit: 255
+    t.integer  "photos_count",                default: 0
+    t.integer  "favorites_count",             default: 0
     t.integer  "category_id"
   end
 
   add_index "creations", ["created_at"], name: "index_creations_on_created_at", using: :btree
   add_index "creations", ["user_id"], name: "index_creations_on_user_id", using: :btree
 
-  create_table "delayed_jobs", force: true do |t|
-    t.integer  "priority",   default: 0
-    t.integer  "attempts",   default: 0
+  create_table "delayed_jobs", force: :cascade do |t|
+    t.integer  "priority",               default: 0
+    t.integer  "attempts",               default: 0
     t.text     "handler"
     t.text     "last_error"
     t.datetime "run_at"
     t.datetime "locked_at"
     t.datetime "failed_at"
-    t.string   "locked_by"
-    t.string   "queue"
-    t.datetime "created_at",             null: false
-    t.datetime "updated_at",             null: false
+    t.string   "locked_by",  limit: 255
+    t.string   "queue",      limit: 255
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
   add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
 
-  create_table "favorites", force: true do |t|
+  create_table "favorites", force: :cascade do |t|
     t.integer  "user_id"
     t.integer  "creation_id"
     t.datetime "created_at"
@@ -101,47 +101,47 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "favorites", ["creation_id"], name: "index_favorites_on_creation_id", using: :btree
   add_index "favorites", ["user_id"], name: "index_favorites_on_user_id", using: :btree
 
-  create_table "interests", force: true do |t|
-    t.string   "name"
-    t.datetime "created_at", null: false
-    t.datetime "updated_at", null: false
+  create_table "interests", force: :cascade do |t|
+    t.string   "name",       limit: 255
+    t.datetime "created_at"
+    t.datetime "updated_at"
   end
 
-  create_table "locations", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
+  create_table "locations", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
     t.uuid     "locatable_id"
-    t.string   "locatable_type"
-    t.string   "latitude"
-    t.string   "longitude"
-    t.string   "city"
-    t.string   "country"
+    t.string   "locatable_type", limit: 255
+    t.string   "latitude",       limit: 255
+    t.string   "longitude",      limit: 255
+    t.string   "city",           limit: 255
+    t.string   "country",        limit: 255
     t.datetime "created_at"
     t.datetime "updated_at"
   end
 
-  create_table "photos", force: true do |t|
+  create_table "photos", force: :cascade do |t|
     t.integer  "imageable_id"
-    t.string   "image"
+    t.string   "image",             limit: 255
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.string   "image_tmp"
+    t.string   "image_tmp",         limit: 255
     t.boolean  "image_processing"
-    t.string   "content_type"
-    t.string   "original_filename"
+    t.string   "content_type",      limit: 255
+    t.string   "original_filename", limit: 255
     t.float    "latitude"
     t.float    "longitude"
-    t.string   "sha256"
-    t.string   "watermark"
-    t.string   "imageable_type"
+    t.string   "sha256",            limit: 255
+    t.string   "watermark",         limit: 255
+    t.string   "imageable_type",    limit: 255
   end
 
   add_index "photos", ["imageable_id"], name: "index_photos_on_imageable_id", using: :btree
 
-  create_table "taggings", force: true do |t|
+  create_table "taggings", force: :cascade do |t|
     t.integer  "tag_id"
     t.integer  "taggable_id"
-    t.string   "taggable_type"
+    t.string   "taggable_type", limit: 255
     t.integer  "tagger_id"
-    t.string   "tagger_type"
+    t.string   "tagger_type",   limit: 255
     t.string   "context",       limit: 128
     t.datetime "created_at"
   end
@@ -152,14 +152,14 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "taggings", ["tagger_id"], name: "index_taggings_on_tagger_id", using: :btree
   add_index "taggings", ["tagger_type"], name: "index_taggings_on_tagger_type", using: :btree
 
-  create_table "tags", force: true do |t|
-    t.string  "name"
-    t.integer "taggings_count", default: 0
+  create_table "tags", force: :cascade do |t|
+    t.string  "name",           limit: 255
+    t.integer "taggings_count",             default: 0
   end
 
   add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
 
-  create_table "tools", force: true do |t|
+  create_table "tools", force: :cascade do |t|
     t.string   "name",        null: false
     t.text     "description"
     t.string   "asin",        null: false
@@ -170,26 +170,26 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "tools", ["asin"], name: "index_tools_on_asin", using: :btree
   add_index "tools", ["name"], name: "index_tools_on_name", unique: true, using: :btree
 
-  create_table "tutorials", force: true do |t|
-    t.string   "heading"
+  create_table "tutorials", force: :cascade do |t|
+    t.string   "heading",     limit: 255
     t.text     "description"
-    t.string   "url"
+    t.string   "url",         limit: 255
     t.integer  "user_id"
-    t.datetime "created_at",  null: false
-    t.datetime "updated_at",  null: false
-    t.string   "image_url"
-    t.string   "author"
-    t.string   "author_url"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+    t.string   "image_url",   limit: 255
+    t.string   "author",      limit: 255
+    t.string   "author_url",  limit: 255
   end
 
   add_index "tutorials", ["user_id"], name: "index_tutorials_on_user_id", using: :btree
 
-  create_table "user_sessions", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
+  create_table "user_sessions", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
     t.integer  "user_id"
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.string   "key"
-    t.string   "ip"
+    t.string   "key",         limit: 255
+    t.string   "ip",          limit: 255
     t.text     "user_agent"
     t.datetime "accessed_at"
     t.datetime "revoked_at"
@@ -200,20 +200,20 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "user_sessions", ["revoked_at"], name: "index_user_sessions_on_revoked_at", using: :btree
   add_index "user_sessions", ["user_id"], name: "index_user_sessions_on_user_id", using: :btree
 
-  create_table "users", force: true do |t|
-    t.string   "email",                              default: "", null: false
-    t.string   "password_digest",        limit: 128, default: "", null: false
-    t.string   "reset_password_token"
+  create_table "users", force: :cascade do |t|
+    t.string   "email",                  limit: 255, default: "", null: false
+    t.string   "password_digest",        limit: 255, default: "", null: false
+    t.string   "reset_password_token",   limit: 255
     t.datetime "reset_password_sent_at"
     t.datetime "created_at"
     t.datetime "updated_at"
-    t.string   "name"
-    t.string   "website"
-    t.string   "twitter"
-    t.string   "facebook"
-    t.string   "city"
-    t.string   "authentication_token"
-    t.string   "full_address"
+    t.string   "name",                   limit: 255
+    t.string   "website",                limit: 255
+    t.string   "twitter",                limit: 255
+    t.string   "facebook",               limit: 255
+    t.string   "city",                   limit: 255
+    t.string   "authentication_token",   limit: 255
+    t.string   "full_address",           limit: 255
     t.integer  "creations_count",                    default: 0
     t.boolean  "admin"
   end
@@ -223,7 +223,7 @@ ActiveRecord::Schema.define(version: 20141206152512) do
   add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
   add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
 
-  create_table "users_interests", id: false, force: true do |t|
+  create_table "users_interests", id: false, force: :cascade do |t|
     t.integer "user_id"
     t.integer "interest_id"
   end
spec/controllers/sitemap_controller_spec.rb
@@ -9,9 +9,12 @@ describe SitemapController do
 
     it "returns the correct headers and body" do
       get :index, format: :xml
+
       expect(response).to be_success
       expect(response.body).to_not be_empty
       expect(response.content_type).to eql('application/xml')
+      expect(response.body).to include(cake_url(cake))
+      expect(response.body).to include(tutorial_url(tutorial))
     end
   end
 end
Gemfile
@@ -18,8 +18,8 @@ gem 'jquery-turbolinks'
 gem 'mini_magick'
 gem "kaminari"
 gem 'bootstrap-sass', '~> 2.3.0'
-#gem 'delayed_job'
-gem 'delayed_job_active_record'
+gem 'delayed_job', github: 'eitoball/delayed_job', branch: 'rails_4_2'
+gem 'delayed_job_active_record', github: 'mokhan/delayed_job_active_record', branch: 'rails-42'
 gem 'daemons'
 gem 'dotenv-rails'
 gem 'pg'
Gemfile.lock
@@ -1,3 +1,20 @@
+GIT
+  remote: git://github.com/eitoball/delayed_job.git
+  revision: 6c16b7d3574208a9475c4dd08e8dad4861be1def
+  branch: rails_4_2
+  specs:
+    delayed_job (4.0.4)
+      activesupport (>= 3.0, < 4.3)
+
+GIT
+  remote: git://github.com/mokhan/delayed_job_active_record.git
+  revision: 7fd31a1391dd98676355150fc3a56a879193a820
+  branch: rails-42
+  specs:
+    delayed_job_active_record (4.0.2)
+      activerecord (>= 3.0, < 4.3)
+      delayed_job (>= 3.0, < 4.1)
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -113,8 +130,6 @@ GEM
     database_cleaner (1.3.0)
     debug_inspector (0.0.2)
     debugger-linecache (1.2.0)
-    delayed_job (2.0.6)
-      daemons
     diff-lcs (1.2.5)
     docile (1.1.5)
     dotenv (1.0.2)
@@ -440,7 +455,8 @@ DEPENDENCIES
   daemons
   dalli
   database_cleaner
-  delayed_job
+  delayed_job!
+  delayed_job_active_record!
   dotenv-deployment
   dotenv-rails
   ejs