Class: Homeland::NodesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/homeland/nodes_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#admin?, #authenticate_user!, #authorize_admin!, #authorize_resource!, #current_user, #owner?, #set_seo_meta

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'app/controllers/homeland/nodes_controller.rb', line 14

def create
  @node = Node.new(node_params)
  if @node.save
    redirect_to(node_topics_path(@node), notice: t('homeland.node_created'))
  else
    render action: "new"
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/homeland/nodes_controller.rb', line 34

def destroy
  @node.destroy
  redirect_to(nodes_path, notice: t('homeland.node_deleted'))
end

#editObject



23
24
# File 'app/controllers/homeland/nodes_controller.rb', line 23

def edit
end

#indexObject



6
7
8
# File 'app/controllers/homeland/nodes_controller.rb', line 6

def index
  @nodes = Node.order('sort desc')
end

#newObject



10
11
12
# File 'app/controllers/homeland/nodes_controller.rb', line 10

def new
  @node = Node.new
end

#updateObject



26
27
28
29
30
31
32
# File 'app/controllers/homeland/nodes_controller.rb', line 26

def update
  if @node.update_attributes(node_params)
    redirect_to(node_topics_path(@node), notice: t('homeland.node_updated'))
  else
    render action: "new"
  end
end