Class: Workarea::Api::Admin::ReleasesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/api/admin/releases_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #sort_direction, #sort_field

Instance Method Details

#bulkObject



282
283
284
285
286
287
288
289
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 282

def bulk
  @bulk = Api::Admin::BulkUpsert.create!(
    klass: Release,
    data: params[:releases].map(&:to_h)
  )

  head :no_content
end

#createObject



105
106
107
108
109
110
111
112
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 105

def create
  @release = Release.create!(params[:release])
  respond_with(
    { release: @release },
    { status: :created,
    location: release_path(@release) }
  )
end

#destroyObject



291
292
293
294
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 291

def destroy
  @release.destroy
  head :no_content
end

#indexObject



97
98
99
100
101
102
103
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 97

def index
  @releases = Release
                .all
                .order_by(sort_field => sort_direction)
                .page(params[:page])
  respond_with releases: @releases
end

#showObject



244
245
246
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 244

def show
  respond_with release: @release
end

#updateObject



248
249
250
251
# File 'app/controllers/workarea/api/admin/releases_controller.rb', line 248

def update
  @release.update_attributes!(params[:release])
  respond_with release: @release
end