Permalink
Browse files

permissions-associations

## Associations

Although we have modelled the assignment of tasks to users, at the moment there is no way for the user to set these assignments. We'll add that to the task edit page. Create a task and browse to the edit page - only the description is editable. Hobo does provide support for "multi-model" forms, but it is not active by default. To specify that a particular association should be accessible to updates from the form, you need to declare `:accessible => true` on the association. In `task.rb`, edit the `has_many :users` association as follows:

SHOW_PATCH

Without that declaration, the permission system was reporting that
this association was not editable. Now that the association is
"accessible", the permission system will check for create and destroy
permission on the join model `TaskAssignment`. As long as the current
user has those permissions, the task edit page should now include a
nice javascript powered control for assigning users in the edit-task
page.

Right now the only people who have this permission are the site
administrators.  (The first user who signs up automatically becomes
a site administrator).  We'll add permissions for other users later on
in [Project Ownership](#project_ownership).
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent b5734af commit 1732b128807b376a1971a80b69922d780287d4a8
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/task.rb
View
@@ -11,7 +11,7 @@ class Task < ActiveRecord::Base
belongs_to :story, :inverse_of => :tasks, :counter_cache => true
has_many :task_assignments, :dependent => :destroy, :inverse_of => :task
has_many :users, :through => :task_assignments
has_many :users, :through => :task_assignments, :accessible => true, :dependent => :destroy
# --- Permissions --- #

0 comments on commit 1732b12

Please sign in to comment.