Sha256: f5021249fa02d759c33e6282e2c406a716b0ccf9034699061d4a5a4d344a7ad2

Contents?: true

Size: 542 Bytes

Versions: 7

Compression:

Stored size: 542 Bytes

Contents

class Comment < ActiveRecord::Base

  def create_permitted?
    # for testing we allow anything if there is no acting_user
    # in the real world you would have something like this:
    # acting_user and (acting_user.admin? or user_is? acting_user)
    !acting_user or user_is? acting_user
  end

  def destroy_permitted?
    !acting_user or user_is? acting_user
  end

  belongs_to :user
  belongs_to :todo_item

  has_one :todo, -> {}, class_name: "TodoItem"  # this is just so we can test scopes params and null belongs_to relations

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hyper-mesh-0.6.0 reactive_record_test_app/app/models/public/comment.rb
hyper-mesh-0.5.4 reactive_record_test_app/app/models/public/comment.rb
hyper-mesh-0.5.3 reactive_record_test_app/app/models/public/comment.rb
hyper-mesh-0.5.2 reactive_record_test_app/app/models/public/comment.rb
hyper-mesh-0.5.1 reactive_record_test_app/app/views/models/comment.rb
hyper-mesh-0.5.0 reactive_record_test_app/app/views/models/comment.rb
hyper-mesh-0.4.0 reactive_record_test_app/app/views/models/comment.rb