Class: Homeland::NodesController
Instance Method Summary
collapse
#admin?, #authenticate_user!, #authorize_admin!, #authorize_resource!, #current_user, #owner?, #set_seo_meta
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#edit ⇒ Object
23
24
|
# File 'app/controllers/homeland/nodes_controller.rb', line 23
def edit
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/homeland/nodes_controller.rb', line 6
def index
@nodes = Node.order('sort desc')
end
|
#new ⇒ Object
10
11
12
|
# File 'app/controllers/homeland/nodes_controller.rb', line 10
def new
@node = Node.new
end
|
#update ⇒ Object
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
|