Class: EricWeixin::Cms::Weixin::ReplyMessageRulesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 13

def create
  begin
    ::EricWeixin::ReplyMessageRule.create_reply_message_rule params
    flash[:success] = "创建成功。"
    redirect_to action: :index
  rescue Exception=>e
    dispose_exception e
    flash.now[:alert] = get_notice_str
    @public_accounts = ::EricWeixin::PublicAccount.all
    render :new
  end
end

#destroyObject



44
45
46
47
48
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 44

def destroy
  rule = ::EricWeixin::ReplyMessageRule.find(params[:id])
  @rule_id = rule.id
  rule.destroy
end

#editObject



26
27
28
29
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 26

def edit
  @rule = ::EricWeixin::ReplyMessageRule.find(params[:id])
  @public_accounts = ::EricWeixin::PublicAccount.all
end

#indexObject



4
5
6
7
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 4

def index
  @reply_message_rules = ::EricWeixin::ReplyMessageRule.valid.paginate(page: params[:page], per_page:params[:per_page]||10)
  @public_accounts = ::EricWeixin::PublicAccount.all
end

#newObject



9
10
11
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 9

def new
  @public_accounts = ::EricWeixin::PublicAccount.all
end

#updateObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/eric_weixin/cms/weixin/reply_message_rules_controller.rb', line 31

def update
  begin
    @reply_message_rule = ::EricWeixin::ReplyMessageRule.update_reply_message_rule(params[:id],params)
    flash[:success] = "更新成功。"
    redirect_to action: :index
  rescue Exception=> e
    dispose_exception e
    flash.now[:alert] = get_notice_str
    @public_accounts = ::EricWeixin::PublicAccount.all
    render :edit
  end
end