Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rails 4 1 enum #3

Merged
merged 4 commits into from Jun 11, 2014
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -3,7 +3,7 @@ class PostsController < ApplicationController
before_filter :mobile_redirect, if: :ensure_mobile?

def index
@posts = Post.all
@posts = Post.published
respond_with @posts, layout: render_layout?
end

@@ -1,6 +1,9 @@
class Post < ActiveRecord::Base
include Analytix::Model


enum status: [:draft, :published]
# enum status: { published: 1, draft: 0 }

validates :title, presence: true
has_many :comments
end
@@ -0,0 +1,5 @@
class AddStatusToPosts < ActiveRecord::Migration
def change
add_column :posts, :status, :integer, default: 0
end
end
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140312153455) do
ActiveRecord::Schema.define(version: 20140604070520) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -31,6 +31,7 @@
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "status", default: 0
end

end
ProTip! Use n and p to navigate between commits in a pull request.