#509 open
Matt Jones

Add :owner marker to belongs_to, for easier permissions checking

Reported by Matt Jones | October 23rd, 2009 @ 09:19 AM | in Beyond Hobo 1.0

And a corresponding helper (maybe owned_by?(user)) to clean up a common permission case.

class Foo < ActiveRecord::Base
  hobo_model

  belongs_to :some_model, :owner => true

  def update_permitted?
    acting_user.administrator? || owned_by?(acting_user)
  end
end

It might even make sense to roll a none_changed?(:some_model_id) into owned_by.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages