Sha256: 137d4f3b9e4fee510d0dcd55cf72bb027b6557ec193432b303f6948534249b52

Contents?: true

Size: 791 Bytes

Versions: 9

Compression:

Stored size: 791 Bytes

Contents

module RemoteDb
  module Concerns
    module ReadOnlyModel
      extend ActiveSupport::Concern

      included do
        attr_readonly(*column_names) unless abstract_class?
      end

      module ClassMethods
        def delete(id_or_array)
          raise ActiveRecord::ReadOnlyRecord
        end

        def delete_all(conditions = nil)
          raise ActiveRecord::ReadOnlyRecord
        end

        def update_all(conditions = nil)
          raise ActiveRecord::ReadOnlyRecord
        end
      end

      def readonly?
        true
      end

      def destroy
        raise ActiveRecord::ReadOnlyRecord
      end

      def delete
        raise ActiveRecord::ReadOnlyRecord
      end

      def update_column
        raise ActiveRecord::ReadOnlyRecord
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
remote_db-0.0.9 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.8 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.7 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.6 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.5 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.4 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.3 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.2 lib/remote_db/concerns/read_only_model.rb
remote_db-0.0.1 lib/remote_db/concerns/read_only_model.rb