Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've done this by overriding the invites controller, the instructions to do this are in the devise_invitable main page on github so I won't go into it here. </p> <p>For security, I created a new table that holds extra invitation information so that the email accept link does not hold the group link (my groups are by private invites only so I don't want a invited user to alter the invite url in the email and potentially add other groups which they were not invited). </p> <p>The new table is indexed by the user id after devise_invitable creates it in the user table.</p> <pre><code>class Users::InvitesController &lt; Devise::InvitationsController . . def create # make sure the current user is connected to this object for security if @object.has_connection_with(current_user) # perform the invite self.resource = resource_class.invite!(params[resource_name], current_inviter) #since we invite based on object, we must reference this object once the user accepts, so we store this in our Invites table object_invite = Invite.new(:invitable_type =&gt; @object.class.name, :invitable_id =&gt; @object.id, :user_id =&gt; self.resource.id, :inviter_id =&gt; current_inviter.profile.id) object_invite.save! if resource.errors.empty? set_flash_message :notice, :send_instructions, :email =&gt; self.resource.email #respond_with resource, :location =&gt; after_invite_path_for(resource) render :json =&gt; {:status =&gt; 'success'} and return else respond_with_navigational(resource) { render_with_scope :new } end end end </code></pre> <p>Then in your update method (again in the same controller) you can find() the Invites record and pull the required info that will allow you to connect the new user to the group.</p> <p>The only issue left is how to add additional parameters to the email, like group name, which I have yet to resolve.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload