Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## 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
1 parent
5a1c938
commit 7fd1e13
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class StoryStatusesController < ApplicationController | ||
|
||
hobo_model_controller | ||
|
||
auto_actions :all | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
class StoryStatus < ActiveRecord::Base | ||
|
||
hobo_model # Don't put anything above this | ||
|
||
fields do | ||
name :string | ||
timestamps | ||
end | ||
|
||
# --- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Read about fixtures at http://ar.rubyonrails.org/classes/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class StoryStatusesControllerTest < ActionController::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'test_helper' | ||
|
||
class StoryStatusTest < ActiveSupport::TestCase | ||
# Replace this with your real tests. | ||
test "the truth" do | ||
assert true | ||
end | ||
end |