Class: Admin::ResponsesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/wechat/admin/responses_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
# File 'app/controllers/wechat/admin/responses_controller.rb', line 20

def create
  @response = @app.responses.build(response_params)

  unless @response.save
    render :new, locals: { model: @response }, status: :unprocessable_entity
  end
end

#edit_replyObject



28
29
30
31
32
33
34
35
# File 'app/controllers/wechat/admin/responses_controller.rb', line 28

def edit_reply
  q_params = {
    appid: @app.appid
  }
  q_params.merge! type: @response.reply.type if @response.reply

  @replies = Reply.where(q_params)
end

#filter_replyObject



37
38
# File 'app/controllers/wechat/admin/responses_controller.rb', line 37

def filter_reply
end

#indexObject



7
8
9
10
11
12
13
14
# File 'app/controllers/wechat/admin/responses_controller.rb', line 7

def index
  q_params = {
    type: ['TextResponse', 'PersistScanResponse', 'EventResponse']
  }
  q_params.merge! params.permit(:type)

  @responses = @app.responses.default_where(q_params).order(id: :desc).page(params[:page])
end

#newObject



16
17
18
# File 'app/controllers/wechat/admin/responses_controller.rb', line 16

def new
  @response = @app.responses.build
end