Permalink
Browse files

generate-story-status-model

## Have a configurable set of statuses

In order to support management of the statuses available, we'll create a StoryStatus model

	$ hobo generate resource story_status name:string
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent a2b7deb commit 48a8223ecfdfbbbcd87309c48a441e9a047c555f
@@ -0,0 +1,7 @@
class StoryStatusesController < ApplicationController
hobo_model_controller
auto_actions :all
end
View
@@ -0,0 +1,29 @@
class StoryStatus < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
name :string
timestamps
end
attr_accessible :name
# --- Permissions --- #
def create_permitted?
acting_user.administrator?
end
def update_permitted?
acting_user.administrator?
end
def destroy_permitted?
acting_user.administrator?
end
def view_permitted?(field)
true
end
end
@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value
@@ -0,0 +1,7 @@
require 'test_helper'
class StoryStatusesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
@@ -0,0 +1,7 @@
require 'test_helper'
class StoryStatusTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 48a8223

Please sign in to comment.