问题标签 [ruby-on-rails-4]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
4653 浏览

heroku - OpenSSL::Cipher::CipherError 在 JRuby 上使用 Rails4

Rails4 默认使用加密的 cookie 会话存储。当应用程序尝试加密 cookie 时,会引发以下错误:OpenSSL::Cipher::CipherError: Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE(stacktrace:https ://gist.github.com/8ba56b18060ae30e4d44 )。

正如这里提到的,这可以通过降级密码学或安装 JCE 来解决——第一个是我真的不想做的事情,而后者在 heroku 上是不可能的(afaik)。

0 投票
1 回答
475 浏览

ruby - Omniauth Github 身份验证

我正在构建一个允许用户使用他们的 Github 身份验证凭据登录的应用程序。问题是,我在文档中找不到任何关于限制对某些用户的访问的内容。例如,我希望来自一组特定组织的用户能够登录并非所有只有 github 帐户的人。有什么帮助吗?

0 投票
2 回答
1122 浏览

ruby - Rails 4 中的 Omniauth 身份验证失败

我在 rails 4 工作,我正在尝试使用 github 进行身份验证。所以在我的 Github 应用程序中,我有这个:

网址:http://localhost:4000

回调地址:http://localhost:4000/auth/github/callback

回调 url 是认证完成时 Github 将尝试到达的 url 对吗?

那么为什么当我点击我的链接时会出现 Github 页面 404 错误:

我正在开发本地主机开发环境,所以这可能是问题所在?

此外,当我http:// localhost:4000/auth/github/callback在浏览器上输入时,我得到一个 OmniAuth::Strategies::OAuth2::CallbackError

为什么?我的 routes.rb 中有这个

Rails 4 和 Omniauth 有问题吗?(在 localhost 中添加了空格,因此 stackoverflow 接受了我的帖子)

0 投票
1 回答
1101 浏览

ruby-on-rails-3 - 正确的 Github 应用程序 URL

在 Github 的应用程序中注册的正确 URL 是什么?我有一个rails 应用程序,我正试图通过omniauth/devise 连接到github。问题是每次我尝试通过设计进行身份验证时,我都会得到这个 URL

在我的浏览器中和来自 GitHub 的 NULL 反馈。(这意味着 env['omniauth.auth'] 为空)。

这是我的 Github 网址。这里有什么问题?

0 投票
2 回答
1479 浏览

ruby-on-rails - 我应该从 rails 2.3 升级到 3+ 还是等到 rails 4 发布后再升级?

我即将开始着手将公司的旧 rails ap 从 2.3/1.87 移植到最新版本的 rails。我应该等待rails 4,还是应该等待3.2?

我们将借此机会确保有完整的测试覆盖率,并且可能还会涉及一些重写。第一个目标是确保所有当前功能都可以运行。

我们希望尽可能多的当前代码库在最新版本的 rails 下工作。我们将重写任何没有的部分。

0 投票
2 回答
6604 浏览

ruby-on-rails - Rails 4 中的会话

如果不推荐使用 ActiveRecord::Store,建议的维护会话的方法是什么?加密cookie存储是新标准吗?如果你想保持 >4kb 的状态怎么办?

0 投票
3 回答
1487 浏览

ruby-on-rails - 如果 Rails 4.0 中没有父模型,如何处理基于键的集合过期?

由于动作和页面缓存以及清扫器将从 Rails 4.0 中删除,我开始cache_digests在我的 Rails 3.2 应用程序中使用,因为我正遭受整个手动过期的噩梦。

但即使在阅读了一些教程(如何基于键的缓存过期工作缓存摘要#387 缓存摘要、...)之后,我也找不到一种好方法来处理没有可以提供时间戳的父对象的视图或类似的东西。

例如,如果DocumentTodolist使用关联touch上的选项,这可以完美地工作。Project

但是index行动呢?

当然,我可以使用任意密钥project_index,例如在项目模型发生任何更改时使其过期,但这需要清扫者或观察者并摆脱它们,包括显式过期是基于密钥过期的主要原因之一。

Rails 4.0的方法是什么?

0 投票
3 回答
8312 浏览

ruby-on-rails - rails 不会将_data 作为文件发送

我在使用 Rails 方法时遇到问题:send_data

这是我的行动:

这不会提示下载,它只是在屏幕上呈现结果。powthin服务器我都试过了。

我无法弄清楚我做错了什么?

我在用着rails 4.0.0.beta

编辑:

卷曲标题:

0 投票
3 回答
4515 浏览

ruby-on-rails - Rails 4 未检测到应用程序

更新到 Rails 4 后,我试图启动服务器,但它不会启动。简而言之,应用程序似乎没有被“检测到”,就像那里没有应用程序一样。

奇怪的是(旧的)系统 gem 可以让它启动得很好,但不能使用 Bundler。

为什么 Rails 无法启动?

我尝试浏览 CLI 源代码,但我无法掌握正在发生的事情。

(使用 Edge Rails 4.0.0.beta 和 Ruby 2.0.0.rc)

如果您想知道,这里是目录列表:

0 投票
1 回答
678 浏览

jquery - jQuery datepicker not initialized after partial inserted

I have a rails 4 application that uses turbo links and jquery.turbolinks. It also uses the jQuery date picker plugin.

I am using Ryan Bates' technique for adding/editing multiple models in one form, from Railscast episode #196 Nested Model Form.

In my case, I am adding/editing people associated with a household. The person_fields partial includes a birthdate field that 'attempts' to use the date picker (a string input with class="datepicker"), but it doesn't work, the datepicker doesn't appear when I click on the field with a class of '.datepicker'.

With other forms that are loaded with the page, the datepicker works fine. But for this form that is added dynamically with this code, the datepicker doesn't appear.

Here's the code for the link that inserts the partial:

And the coffee script for inserting the partial:

And the coffee script for the date picker:

Any help is much appreciated.

--- UPDATE ---

Thanks to Billy Monk's suggestion, the code to add fields now looks like this:

And it works! Much appreciated! Will accept the answer as soon as I'm allowed.