Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails设计用户功能_Ruby On Rails_Devise - Fatal编程技术网

Ruby on rails Rails设计用户功能

Ruby on rails Rails设计用户功能,ruby-on-rails,devise,Ruby On Rails,Devise,用户注册后如何执行特定功能。 (我想添加到我的一个关联中,我已经在非Desive rails中对它进行了编码,但现在我需要它)您可以在用户模型中使用创建后的回调 以下指南中有大量示例:您可以在您的用户模型中使用创建后的回调 以下指南中有大量示例:设备提供了帮助器操作“,在为在路径中签名后,您可以在应用程序控制器中覆盖它 def after_sign_in_path_for(resource_or_scope) .... #write your customize code or call any

用户注册后如何执行特定功能。
(我想添加到我的一个关联中,我已经在非Desive rails中对它进行了编码,但现在我需要它)

您可以在用户模型中使用创建后的
回调


以下指南中有大量示例:

您可以在您的用户模型中使用创建后的
回调


以下指南中有大量示例:

设备提供了帮助器操作“,在为在路径中签名后,您可以在应用程序控制器中覆盖它

def after_sign_in_path_for(resource_or_scope)
.... #write your customize code or call any method
end

设备已提供辅助操作“”,在的路径中签名后,您可以在应用程序控制器中覆盖它

def after_sign_in_path_for(resource_or_scope)
.... #write your customize code or call any method
end

对于signup,它看起来像:

def after_sign_up_path_for(resource_or_scope)
  if resource_or_scope.is_a? User  # and perhaps other conditions
    #... do something, go somewhere
  else
    super
  end
end

Ofc。假设您的Desive用户模型称为user。

对于signup,它看起来像:

def after_sign_up_path_for(resource_or_scope)
  if resource_or_scope.is_a? User  # and perhaps other conditions
    #... do something, go somewhere
  else
    super
  end
end

Ofc。假设您的Desive用户模型被称为user。

对于前面的问题,您有许多不可接受的答案。也许你可以检查一下,看看你是否能接受一些?对于你之前的问题,你有很多不被接受的答案。也许你可以检查一下,看看能不能接受一些?