草庐IT

email-validation

全部标签

ruby-on-rails - 我该怎么办 :remote location validation with CarrierWave?

我在我的Rails3示例应用程序上使用CarrierWave。我想验证远程位置上传,因此当用户提交无效URL(空白或非图像)时,我不会收到标准错误异常:CarrierWave::DownloadErrorinImageController#createtryingtodownloadafilewhichisnotservedoverHTTP这是我的模型:classPaintingtrue,:length=>{:minimum=>5,:maximum=>100}validates:image,:presence=>trueend这是我的Controller:classPaintingsC

ruby-on-rails - rails:为#<StateMachine::Machine:0xba3014ec> 调用了 protected 方法 `around_validation'

我正在尝试实现state_machinegem,在我的rails项目中,我安装了gem,然后我将“state”列添加到我的account_entries模型中:defchangeadd_column:account_entries,:state,:stringend然后在我的account_entries模型中,我添加了状态机初始方法,如下所示:state_machine:state,:initial=>:submitteddoend然后在我看来我显示时间进入状态:account_entry.state但是当我尝试从我的应用程序创建一个account_entry时,我得到了这个错误:p

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 - rails : Validating a Date Greater than Another

我正在ActiveRecord中编写一个自定义验证器,以便截止日期有意义:validate:deadline_is_possible?defdeadline_is_possible?ifdeadline>begins_aterrors.add(:deadline,'mustbepossible')endend然而,这会生成一个“NoMethodError:未定义的方法`>'fornil:NilClass”。我尝试将日期转换为字符串,例如:defdeadline_is_possible?ifdeadline.to_s>begins_at.to_serrors.add(:deadline,

springboot使用validator进行参数校验

1.依赖导入org.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-validation2.validation常用注解@Null被注释的元素必须为null@NotNull被注释的元素不能为null,可以为空字符串@AssertTrue被注释的元素必须为true@AssertFalse被注释的元素必须为false@Min(value)被注释的元素必须是一个数字,其值必须大于等于指定的最小值@Max(value)被注释的元素必须是一个数字,其值必须小于等于指定的最大值@D

ruby-on-rails - "554 Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email."错误 Ruby on Rails

我正在使用RubyonRails构建网络应用程序。我正在使用Mailgun作为这个应用程序的邮件程序。当我使用Facebook注册时它工作正常但是当我尝试使用电子邮件和密码注册时,我不断收到此错误“554请激活您的Mailgun帐户。检查您的收件箱或登录到您的控制面板以重新发送激活电子邮件。“我已经在mailgun仪表板中将eamil授权给授权收件人。这是我的代码:Registrations_controller.rbclassRegistrationsControllerconfig/environments/development.rbRails.application.confi

ruby-on-rails - Ruby 类评估,validates_inclusion_of 与动态数据

如果我有如下的ActiveRecord模型classFooself.allowed_typesdefself.allowed_types#somecodethatreturnsanenumerableendend这不起作用,因为在评估验证时尚未定义allowed_types方法。我能想到的所有修复基本上都是围绕将方法定义移到验证之上,以便在需要时可用。我明白这可能更像是一个编码风格问题(我希望我的所有验证都在模型顶部,方法在底部)但我觉得应该有某种解决方案,可能涉及初始模型加载的惰性评估?我想做的事有可能吗?我应该只在验证之上定义方法,还是有更好的验证解决方案来实现我想要的。

ruby-on-rails - FactoryGirl错误: "Email has already been taken."

使用下面的工厂时出现错误(如下所示)。它可以通过运行rakedb:test:prepare暂时修复,但是,这只会修复一次运行的测试。我可以做些什么来获得更永久的修复?我应该使用database_cleaner吗?如果是这样,任何人都可以提供有关设置的任何见解(我正在使用RSpec、Capybara、Rails4、Ruby2)吗?谢谢!我正在使用以下工厂:FactoryGirl.definedofactory:userdosequence(:username){|n|"Person#{n}"}sequence(:email){|n|"person_#{n}@example.com"}pa

ruby - gem 安装失败,出现 "Could not find a valid gem ' yaml'"

我正在从一个当前可用的ruby​​程序构建一个gem。它使用jruby1.7.12,除其他外,它执行“require'yaml”。对于gem,我的Gemfile包含:source'https://rubygems.org'gemspec当我运行时gembuildprogram.gemspec这很好用,但是当我运行时geminstallprogram-0.15.01.gem它失败了ERROR:Couldnotfindavalidgem'yaml'(>=0)inanyrepositoryERROR:Possiblealternatives:aml,cyaml,haml,maml,raml没

ruby-on-rails - RefineryCMS 引擎错误 : did not have a valid gemspec

我无法安装任何引擎。从指南安装第一个事件引擎后,我收到一条错误消息,提示我没有有效的gem规范。Usingrefinerycms-events(1.0)fromsourceatvendor/extensionsrefinerycms-eventsat/Users/lydia/Desktop/projects/cmsex/vendor/extensions/eventsdidnothaveavalidgemspec.Thispreventsbundlerfrominstallingbinsornativeextensions,butthatmaynotaffectitsfunctiona