-1
我將我的rails應用程序部署到Heroku。我正在嘗試使用Heroku控制檯爲我的應用程序添加類別,但我不知道這些命令。heroku控制檯命令添加類別
控制器:
class PortfolioController < ApplicationController
def index
@posts = Post.all.order("created_at DESC")
end
def about
end
def portfolio
end
def contact
end
def webapp
category = Category.find_by_category('webapp')
@posts = Post.where(category_id: category.id)
end
def art
category = Category.find_by_category('gameart')
@posts = Post.where(category_id: category.id)
end
end
模式:
ActiveRecord::Schema.define(version: 20160910220215) do
create_table "admins", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "admins", ["email"], name: "index_admins_on_email", unique: true
add_index "admins", ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true
create_table "categories", force: :cascade do |t|
t.string "category"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "posts", force: :cascade do |t|
t.string "title"
t.text "content"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.datetime "image_updated_at"
t.integer "category_id"
end
end