Commit cb20f270
Changed files (5)
app
controllers
db
spec
features
app/controllers/categories_controller.rb
@@ -2,7 +2,6 @@ class CategoriesController < ApplicationController
def show
@category = Category.find_by_slug(params[:slug].downcase)
if @category
- @categories = Category.all
@creations = @category.creations.includes(:user).page(params[:page]).per(12)
else
redirect_to creation_tag_path(params[:slug].downcase)
db/migrate/20140521032101_migrate_categories_from_join_table_to_creations.rb
@@ -0,0 +1,8 @@
+class MigrateCategoriesFromJoinTableToCreations < ActiveRecord::Migration
+ def up
+ execute("UPDATE creations AS c SET category_id = cat.category_id FROM creations_categories AS cat WHERE c.id = cat.creation_id")
+ end
+
+ def down
+ end
+end
db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140520023608) do
+ActiveRecord::Schema.define(version: 20140521032101) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
spec/features/upload_creation_spec.rb
@@ -18,7 +18,7 @@ describe "uploading a new creation", :js => true do
fill_in("creation_name", :with => "yummy cake")
fill_in("creation_watermark", :with => "yummy")
fill_in("creation_story", :with => "this was just so damn yummy so i ate it alone.")
- select(category_2.name, :from => 'creation_category')
+ select(category_2.name, :from => 'creation_category_id')
#fill_in("creation_tags", :with => "cake, yummy")
end
click_button("NEXT STEP")