Tag: ruby on rail

如何在Rails中存储第三方服务的凭据

我正在通过SendGrid为我的rails应用程序发送的邮件设置重定向。 但是,我对告知存储凭据的方式并不满意。 在那里指定,他们建议覆盖config / environment.rb文件中的ActionMailers默认值。 我发现我的前任创建了一个初始化器/ smtp.rb文件,他在那里定义了以前的设置,但是通过发现这个文件,我发现了SMTP密码…… 如果我修改任何这些文件,那么有权访问git存储库的人将可以访问凭据(包括我们使用的前端和后端自由职业者)。 我正在考虑创建一个文件,该文件将保留在服务器的共享文件夹(如database.yml文件)上,并且每次部署时都会通过capistrano与应用程序进行符号链接。 你怎么看呢? 将此初始化程序/ smtp.rb移动到服务器的共享文件夹并在部署时将其符号链接是否可以?

“缺少主机链接到!”为Devise

我安装了Devise,每当我尝试创建一个帐户时,事情就会停止。 完整错误如下: Missing host to link to! Please provide :host parameter or set default_url_options[:host] 我在develop.rb块中有以下代码。 我已经尝试过,有没有添加smtp配置。 config.action_mailer.default_url_options = { :host => ‘localhost’ } config.action_mailer.delivery_method = :smtp … 我是否错误地定义了host ?

我可以使用twilio从应用程序拨打个人手机号码吗?

我想从我的网络应用程序浏览器本身(带有迈克的头戴式耳机)作为现场(RTC)拨打我的客户手机号码,并且还应该能够录制音频。 twilio api可能出现这种情况吗?

使用rails-bootstrap-forms设计自定义问题

我正在使用rails-bootstrap-forms gem和devise。 我以前的devise/registrations/new.html.erb代码是 Sign up ( characters minimum) 生成HTML Sign up Email Password (8 characters minimum) Password confirmation Log in 但是现在我编辑了这段代码以使用gem rails-bootstrap-forms我的新代码是 Sign up ( characters minimum) HTML视图是: – Sign up Email (8 characters minimum) Password Password confirmation Log in 我的问题是如何在label:密码中包含行打印(最少x个字符)。 上面的行打印在下一行标签密码中我想用标签密码打印它 我希望HTML输出为 Password (8 characters minimum) 但它的表现 Password (8 characters minimum)

Rails – 添加不在模型和更新模型属性中的属性

我的表单中有3个字段,不在我的数据库中:opening_type,opening_hours,opening_minutes。 我想用这3个字段更新主要属性“打开”(在数据库中)。 我尝试了很多不起作用的东西。 其实我有: attr_accessor :opening_type, :opening_hours, :opening_minutes def opening_type=(opening_type) end def opening_type opening_type = opening.split(“-“)[0] if !opening.blank? end def opening_hours=(opening_hours) end def opening_hours opening_hours = opening.split(“-“)[1] if !opening.blank? end def opening_minutes=(opening_minutes) end def opening_minutes opening_minutes = opening.split(“-“)[2] if !opening.blank? end 我尝试添加类似的东西: def opening=(opening) logger.info “WRITE” if !opening_type.blank? and !opening_hours.blank? and opening_minutes.blank? opening = “” […]

设置Webrick以服务于我的rails应用程序

我尝试在Ubuntu的计算机上托管我的ruby on rails app,但我无法得到它。 我尝试从我的路由器设置向前移植。 我想我成功地将端口转发到源端口80 – 8080和目标端口3000.然后我在生产模式下启动webrick。 但是,我无法通过键入我的外部IP从互联网上打开我的应用程序。 如何以正确的方式设置计算机? 你有什么建议吗? 谢谢…

更改设计消息“已发送电子邮件”

我在我的ruby on rails应用程序中使用了devise gem。 在用户注册时,如果已存在电子邮件,则会显示默认消息“已收到电子邮件”。 我在en.yml中更改了此消息 activerecord: errors: messages: taken: “User with same email already exists. Please try with another email address.” 在视图中我使用过: 现在我得到的信息是 “Email User with same email already exists. Please try with another email address.” 问题是在开始时附加了“电子邮件”。 有没有其他方法可以更改此默认消息?

Rails:帮助解决rake中止错误!

我一直在尝试运行rake db:migrate命令,但它无法正常工作。 我卸载并安装了gem,但没有运气。 我在某处读到了o.9不稳定,0.8.7没问题。 我试了但是我也有错误.. 现在错误是 Fayimora-Femi-Baloguns-MacBook-Pro:sample_app fayimora$ bundle exec rake db:migrate /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /usr/local in PATH, mode 040777 (in /Users/fayimora/Sites/rails_projects/sample_app) DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from /Users/fayimora/Sites/rails_projects/sample_app/config/application.rb:12) DEPRECATION WARNING: config.generators in Rails::Railtie […]

Devise中的NoMethodError :: Registrations #new

当我尝试注册我的应用程序时,我一直收到此错误,我正在使用设计进行身份validation; NoMethodError in Devise::Registrations#new undefined method `registration_path’ for #<#:0x007fe45d9ffd78> Extracted source (around line #3): Sign up resource_name, :url => registration_path(resource_name)) do |f| %> 当我跑到rake routes我得到了; Prefix Verb URI Pattern Controller#Action new_user_session GET /users/sign_in(.:format) devise/sessions#new user_session POST /users/sign_in(.:format) devise/sessions#create destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy user_password POST /users/password(.:format) devise/passwords#create new_user_password GET /users/password/new(.:format) devise/passwords#new edit_user_password GET /users/password/edit(.:format) devise/passwords#edit PATCH […]

扩展Devise以使用远程登录

我正在尝试关注这篇博客文章以允许使用设计进行远程身份validation,但我无法弄清楚一些事情。 我怎么称呼我的新文件,我在哪里放? 第一个, Devise::Models::RemoteAuthenticatable我假设我调用remote_authenticatable.rb并在我的模型文件夹中放入一个Devise::Models::RemoteAuthenticatable文件夹? 第二个文件,“设计的Warden策略”我不知道该怎么称呼,或者把它放在哪里。 有任何想法吗? 我发现教程很不完整。 它与Devise指令相关联,作为执行此操作的方式。 编辑: 我一直在做更多阅读,我不确定我是否需要按照博客文章中的说法去做。 我一直试图简单地将数据PUT到我的Rails应用程序,但无法获得任何工作。 执行PUT请求会导致设置松散身份validation。