Class: NodesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#fresh_when, #redirect_back_or_default, #redirect_referrer_or_default, #render_403, #render_404, #render_optional_error_file, #require_user, #set_active_menu, #set_locale, #set_seo_meta, #store_location, #unread_notify_count

Instance Method Details

#blockObject


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

def block
  current_user.block_node(params[:id])
  render json: { code: 0 }
end

#indexObject


4
5
6
7
# File 'app/controllers/nodes_controller.rb', line 4

def index
  @nodes = Node.all
  render json: @nodes, only: [:name], methods: [:id]
end

#unblockObject


14
15
16
17
# File 'app/controllers/nodes_controller.rb', line 14

def unblock
  current_user.unblock_node(params[:id])
  render json: { code: 0 }
end