jjzjj

Mark_Sign

全部标签

ruby-on-rails - Rails 5,公寓和设计 : sign in with subdomains are not working

我已经使用Apartment设置了一个Rails5应用程序(1.2.0)和Devise(4.2.0)。由于某些DDNS问题,应用只能在app.myapp.com下访问(请注意子域app)。myapp.com重定向到app.myapp.com。我的用例是每个注册该应用的用户(租户)都应该通过他们的子域(例如tenant.myapp.com)访问他们的特定数据。用户不应限定在其子域内。基本上应该可以从任何子域登录。重定向到租户的正确子域由ApplicationController处理。根据Devise标准,登录页面位于app.myapp.com/users/sign_in。这就是问题开始的

ruby-on-rails - Rails 设计 : "You need to sign in or sign up before continuing" instead of "You will receive an email with instructions.."

我已经安装了DeviseonRails4.2.0,一切似乎都在工作,我使用了以下指南:http://sourcey.com/rails-4-omniauth-using-devise-with-twitter-facebook-and-linkedin/我的设计模块是:devise:database_authenticatable,:registerable,:confirmable,:recoverable,:rememberable,:trackable,:validatable,:omniauthable唯一的问题是,如果我尝试通过转到注册页面创建一个新帐户,然后在输入我的电子邮

ruby-on-rails - 目录 : Forgot Password & Sign In - in same page

我正在尝试将忘记密码字段与登录页面放在一起,但如果用户未注册(并且不在应用程序数据库中),则它会重定向到原始设计的忘记密码页面并出现错误(http://localhost:3000/用户/密码)。如何使错误出现在与登录页面(http://localhost:3000/users/sign_in)相同的页面中?在app/views/devise/sessions/new.html.erb文件中ForgotPasswordEntertheemailyousignedupwith所以有一个javascript链接,如果用户忘记了他们的登录凭据,输入字段将显示在该链接上。

c - (U) Ruby 扩展 : rb_gc_mark() and instance variables

我正在编写定义类的ruby​​扩展。如果我使用Data_Wrap_Struct()来实现我对rb_define_alloc_func()的回调,我是否需要手动标记和释放实例变量?还是仍然为我处理? 最佳答案 Ruby的GC将收集在您的Ruby对象的实例变量中引用的所有Ruby对象。您不必也不应该自己释放Ruby实例变量(即在您的扩展中使用rb_iv_set()/rb_iv_get()访问的任何对象)。但是,如果包装的Cstruct引用Ruby对象,那么您必须在传递给Data_Wrap_Struct()的mark回调中标记这些对象。(

ruby-on-rails - 找不到 id=sign_out 的用户

注销链接在我的Rails应用程序中不起作用。我检查了下面列出的routes.rb,我的application.html.erb看起来遵循正确的路径。出现以下错误。ActiveRecord::RecordNotFoundinUsersController#showCouldn'tfindUserwithid=sign_outRails.root:/Users/patrickwalsh/rails_projects/ytutorialApplicationTrace|FrameworkTrace|FullTraceapp/controllers/users_controller.rb:4:

ruby-on-rails - Rails 4 + Rspec + 设计 : undefined method 'env' in controller specs for sign_in a user

在我的spec_helper.rb中我添加了config.includeDevise::TestHelpers,:type=>:controller在:allhook之前的Controller规范中,我正在尝试使用此代码登录用户@request.env["devise.mapping"]=Devise.mappings[:user]user=FactoryGirl.create(:confirmed_user)sign_inuser并得到NoMethodError:undefinedmethod`env'fornil:NilClass。有什么想法吗? 最佳答

ruby-on-rails - 在 Devise 中,last_sign_in_at 的用途是什么?

Devise中的标准用户列是last_sign_in_at,当current_sign_in_at更新时,它保存current_sign_in_at的先前值。last_sign_in_at是否对Devise的核心功能或模块功能有任何实用性,还是只是为了方便起见? 最佳答案 last_sign_in_at是用户在当前session之前登录的日期和时间,即current_sign_in_at。如果他们还没有登录或者这是他们的第一次session,它将是nil。更好的名称可能是previous_sign_in_at,因为这不是他们上次(当

ruby - 命名约定 : Why Array#delete has no exclamation mark at the end?

我正在学习Ruby,我发现按照惯例,方法名称末尾的感叹号表示该方法以某种方式修改了self。为什么Array#delete不像slice!那样以感叹号结尾,因为delete从self中删除一个元素?我错过了一些基本的东西吗? 最佳答案 引用Matz(Ruby的总工程师):Thebang(!)doesnotmean"destructive"norlackofitmeannondestructiveeither.Thebangsignmeans"thebangversionismoredangerousthanitsnonbangcou

ruby-on-rails - rails : Plus sign in GET-Request replaced by space

在Rails3(Ruby1.9.2)中我发送一个请求StartedGET"/controller/action?path=/41_+"但是参数列表是这样的:{"path"=>"/41_","controller"=>"controller","action"=>"action"}这里出了什么问题?-、*或.符号工作正常,只是+将被空格替换。 最佳答案 这是正常的URL编码,theplussignisashorthandforaspace:Withinthequerystring,theplussignisreservedasshor

ruby-on-rails - Ruby on Rails - 设计用户/sign_out 不工作

我正在使用设计sign_in和sign_up网址有效但是,当我尝试url时:http://localhost:3000/users/sign_out它产生路由错误Noroutematches[GET]"/users/sign_out"我该如何解决这个问题?rake路rakeroutesnew_user_sessionGET/users/sign_in(.:format){:action=>"new",:controller=>"devise/sessions"}user_sessionPOST/users/sign_in(.:format){:action=>"create",:con