Class: Admin::TbRedirectsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/tb_redirects_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



22
23
24
25
26
# File 'app/controllers/admin/tb_redirects_controller.rb', line 22

def create
  @tb_redirect = TbRedirect.create_smart(tb_redirect_params.merge(created_by: 'user'))
  flash[:notice] = 'Redirect created successfully' if @tb_redirect.errors.none?
  respond_with @tb_redirect, location: admin_tb_redirects_path
end

#destroyObject



39
40
41
42
# File 'app/controllers/admin/tb_redirects_controller.rb', line 39

def destroy
  flash[:notice] = 'Redirect deleted successfully' if @tb_redirect.destroy
  respond_with @tb_redirect, location: admin_tb_redirects_path
end

#editObject



28
29
30
# File 'app/controllers/admin/tb_redirects_controller.rb', line 28

def edit
  respond_with @tb_redirect
end

#indexObject



7
8
9
10
11
# File 'app/controllers/admin/tb_redirects_controller.rb', line 7

def index
  @tb_redirects = TbRedirect.ordered.paginate(page: params[:page])
  @tb_redirects = @tb_redirects.search(params[:search]) if params[:search]
  respond_with @tb_redirects
end

#newObject



17
18
19
20
# File 'app/controllers/admin/tb_redirects_controller.rb', line 17

def new
  @tb_redirect = TbRedirect.new
  respond_with @tb_redirect
end

#showObject



13
14
15
# File 'app/controllers/admin/tb_redirects_controller.rb', line 13

def show
  respond_with @tb_redirect
end

#updateObject



32
33
34
35
36
37
# File 'app/controllers/admin/tb_redirects_controller.rb', line 32

def update
  if @tb_redirect.update_attributes(tb_redirect_params)
    flash[:notice] = 'Redirect updated successfully'
  end
  respond_with @tb_redirect, location: admin_tb_redirects_path
end