Class: Interact::Admin::StarsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/interact/admin/stars_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/interact/admin/stars_controller.rb', line 13

def create
  @star = Star.new(star_params)

  if @star.save
    redirect_to admin_stars_url, notice: 'Star was successfully created.'
  else
    render :new
  end
end

#destroyObject



37
38
39
40
# File 'app/controllers/interact/admin/stars_controller.rb', line 37

def destroy
  @star.destroy
  redirect_to admin_stars_url, notice: 'Star was successfully destroyed.'
end

#editObject



26
27
# File 'app/controllers/interact/admin/stars_controller.rb', line 26

def edit
end

#indexObject



4
5
6
7
# File 'app/controllers/interact/admin/stars_controller.rb', line 4

def index
  q_params = params.permit(:user_id, :starred_type, :starred_id)
  @stars = Star.default_where(q_params).page(params[:page])
end

#newObject



9
10
11
# File 'app/controllers/interact/admin/stars_controller.rb', line 9

def new
  @star = Star.new
end

#showObject



23
24
# File 'app/controllers/interact/admin/stars_controller.rb', line 23

def show
end

#updateObject



29
30
31
32
33
34
35
# File 'app/controllers/interact/admin/stars_controller.rb', line 29

def update
  if @star.update(star_params)
    redirect_to admin_stars_url, notice: 'Star was successfully updated.'
  else
    render :edit
  end
end