如何使用devise_invitable发送自定义邀请 [英] How to send custom invitation using devise_invitable

查看:197
本文介绍了如何使用devise_invitable发送自定义邀请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是红宝石的新手,并使用devise_invitable gem进行邀请.每条指令都正确发送.现在,我想添加一个自定义主题,该主题将具有被邀请者的姓名和董事会名称,以及自定义内容,该主题将与该主题具有相同的内容. 如何在不使用额外的自定义代码等的情况下以以下操作方法执行此操作?

I am new at ruby and using devise_invitable gem for invitations. Every instruction is sending properly. Now i want to add a custom subject which will have an invitee name and board name and custom content which will have same things as subject. How can i do this in following action method without using extra custom code etc?

def AddMember
      board = current_user.boards.find(params[:id])  
        # simply invite user ! 
        invitee=User.invite!({:email => (params[:email])}, current_user)
        board.members << User.find_by_email(params[:email]) 
        msg = "invitation sent"
        render json: msg,status: :ok
        return
      end

      msg = "some error occured - member adding failed"
      render json: msg,status: 500

    end

推荐答案

按照说明此处.

可能只是为视图编辑视图模板的情况.

It would just be a case of editing the view template for the view.

首先将这些行添加到Rails App中的environment.rb文件中.

Firstly add these lines to your environment.rb file in your Rails App.

config.to_prepare do
  Devise::Mailer.layout "email" # email.haml or email.erb
end

然后编辑email.erb或email.haml以创建自定义布局.

Then edit the email.erb or email.haml to create your custom layout.

这篇关于如何使用devise_invitable发送自定义邀请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆