scinote-web/app/services/repository_columns/update_column_service.rb

24 lines
546 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module RepositoryColumns
2019-10-16 21:07:46 +08:00
class UpdateColumnService < RepositoryColumns::ColumnService
def initialize(user:, team:, column:, params:)
super(user: user, repository: column.repository, team: team, column_name: nil)
@column = column
@params = params
end
def call
return self unless valid?
if @column.update(@params)
log_activity(:edit_column_inventory)
else
errors[:repository_column] = @column.errors.messages
end
self
end
end
end