How to send custom invitation using devise_invitable

不问归期 提交于 2019-12-01 10:43:19

问题


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

回答1:


Follow the instructions here.

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

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

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



来源:https://stackoverflow.com/questions/31806998/how-to-send-custom-invitation-using-devise-invitable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!