Class: MusicMetadataEnrichment::GroupsController

Inherits:
ApplicationController show all
Includes:
Applicat::Mvc::Controller::Resource, BaseController
Defined in:
app/controllers/music_metadata_enrichment/groups_controller.rb

Instance Method Summary collapse

Methods included from BaseController

#application_navigation, #navigation_product_name, #navigation_product_path

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/music_metadata_enrichment/groups_controller.rb', line 14

def create
  build_group
  @group.user_id = current_user.id
  
  if @group.save
    flash[:notice] = I18n.t('music_metadata_enrichment_groups.create.successful')
    redirect_to music_group_path(@group)
  else
    render :new
  end
end

#indexObject



7
8
# File 'app/controllers/music_metadata_enrichment/groups_controller.rb', line 7

def index
end

#newObject



10
11
12
# File 'app/controllers/music_metadata_enrichment/groups_controller.rb', line 10

def new
  build_group
end

#resourceObject



33
34
35
# File 'app/controllers/music_metadata_enrichment/groups_controller.rb', line 33

def resource
  @group
end

#showObject



26
27
28
29
30
31
# File 'app/controllers/music_metadata_enrichment/groups_controller.rb', line 26

def show
  @group = MusicMetadataEnrichment::Group.find(params[:id])
  @membership = @group.memberships.where(user_id: current_user.id).first if user_signed_in?
  @year = Time.now.strftime('%Y')
  @releases = @group.releases.released_in_year(@year).order('released_at DESC')
end