0

这是第一次使用 devise_invitable gem,没有错误,也没有发送电子邮件

项目控制器.rb

def add_admin
      @email = :email
      User.invite!(:email => @email, :project => current_user.project)
  end

意见/项目/show.html.erb

<% if @project == current_user.project %>
  <% @user = User.new %>
  <%= "you can add admin to " + @project.project_name %>
  <p> please type his email </p>
  <%= form_for @user, url: {controller: "projects", action: "add_admin"} do |f| %>
    <%= f.email_field "email" %>
    <%= f.submit "Invite" %>
  <% end %>
<% end %>

路线.rb

post "/projects/add_admin"
4

1 回答 1

0

最后我找到了

该方法应该是

  def add_admin
      User.invite!(:email => params[:user][:email], :ProjectId => current_user.project.id)
  end
于 2014-11-03T17:20:18.423 回答