Created
January 11, 2010 23:19
-
-
Save owendall/274717 to your computer and use it in GitHub Desktop.
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
class Contact < ActiveRecord::Base | |
hobo_model # Don't put anything above this | |
fields do | |
name :string | |
timestamps | |
end | |
belongs_to :title | |
# --- 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
http://screencast.com/t/ZGFmZDQ0NT | |
http://screencast.com/t/ZjRlM2I5OGIt |
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
class Title < ActiveRecord::Base | |
hobo_model # Don't put anything above this | |
fields do | |
name :string | |
timestamps | |
end | |
has_many :contacts | |
# --- 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment