Module: Admini::Resources

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/admini/resources.rb

Instance Method Summary collapse

Instance Method Details

#createObject



42
43
44
45
46
47
48
# File 'app/controllers/concerns/admini/resources.rb', line 42

def create
  if @resource.save
    redirect_to action: :show, id: @resource.id
  else
    render :new
  end
end

#destroyObject



64
65
66
67
# File 'app/controllers/concerns/admini/resources.rb', line 64

def destroy
  @resource.destroy
  redirect_to action: :index
end

#editObject



53
54
# File 'app/controllers/concerns/admini/resources.rb', line 53

def edit
end

#indexObject



33
34
35
36
37
# File 'app/controllers/concerns/admini/resources.rb', line 33

def index
  @resources = @resources.order(id: :desc)
    .page(params[:page])
    .per(paginates_per)
end

#newObject



39
40
# File 'app/controllers/concerns/admini/resources.rb', line 39

def new
end

#showObject



50
51
# File 'app/controllers/concerns/admini/resources.rb', line 50

def show
end

#updateObject



56
57
58
59
60
61
62
# File 'app/controllers/concerns/admini/resources.rb', line 56

def update
  if @resource.update(resource_params)
    redirect_to action: :show, id: @resource.id
  else
    render :edit
  end
end