Tag: ruby on rails 3

文件上传进度条与回形针上的回形针

我需要显示文件上传的进度条,我不知道。 任何帮助将不胜感激。 应用程序在Heroku上,文件在S3上

在尝试使用capistrano进行部署时,为什么会出现Psych错误?

我目前正在我的Rails 3.2.13应用程序中设置capistrano。 我收到以下错误/详细信息(包括“第1行第1列不允许使用控制字符”)。 我已经做了一些搜索,但没有看到任何与我有关的事情。 我正在使用rvm-capistrano和ruby 2.0.0-p195。 我最近将我的应用程序所需的环境变量移动到.bashrc中。 … * 2013-06-10 15:18:32 executing `deploy:assets:update_asset_mtimes’ * executing “[ -e /home/deployer/apps/super_rad_app/shared/assets/manifest* ] && cat /home/deployer/apps/super_rad_app/shared/assets/manifest* || echo” servers: [“107.20.249.163”] [107.20.249.163] executing command command finished in 6238ms *** [deploy:update_code] rolling back * executing “rm -rf /home/deployer/apps/super_rad_app/releases/20130610221258; true” servers: [“107.20.249.163”] [107.20.249.163] executing command ** [out :: 107.20.249.163] Using /home/deployer/.rvm/gems/ruby-2.0.0-p195 command […]

如何在使用RVM时为Ruby on Rails安装SQlite3

我是编程和Ruby on Rails的新手。 设置我的开发环境一直很糟糕。 我目前的问题是安装Sqlite 3。 当我做 $ bundle install 我明白了 Fetching source index for http://rubygems.org/ Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.1) Using builder (2.1.2) Using i18n (0.4.2) Using activemodel (3.0.1) Using erubis (2.6.6) Using rack (1.2.1) Using rack-mount (0.6.13) Using rack-test (0.5.7) Using tzinfo (0.3.24) Using actionpack (3.0.1) Using mime-types (1.16) […]

如何以这种方式对太阳黑子进行分页?

我有以下模型关联: class Product < ActiveRecord::Base has_many :prices class Price < ActiveRecord::Base belongs_to :product 这是我的控制器 class SearchController 5, :page => params[:page]) end @products = @search.results end end 然后我的看法: 假设我有10个产品,每个产品有20种不同的价格。 我的目标是每页显示5个产品,但如果页面上的价格数量一次超过25个,则价格会运行到下一页。 以下是我希望它做的两个不同的例子: Product 1, 2, 3, 4 + 5 Prices each = same page Product 5 + 6 Prices = this Product with Prices on next page […]

无法找到已弃用的RAILS_ROOT的位置

当我加载rails( rails s )时,终端中显示的第一行是: DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use ::Rails.root.to_s. (called from /Users/x/Sites/x/config/application.rb:7) 我一直无法隔离使用它的地方。 上面提到的第7行是: Bundler.require(:default, Rails.env) if defined?(Bundler) 有没有人有任何建议?

Rails 3.1中的授权:CanCan,CanTango,declarative_authorization?

我查看了declarative_authorization,CanCan和CanTango。 他们都善于为应用程序添加授权,但我想知道如何将授权添加到模型的特定实例,即一个人可以在一个项目中拥有管理访问权限并且仅限于(读取少于管理:有限更新等)在另一个。 你能以更好的方式取悦吗? 如果我的问题听起来太微不足道,请道歉。 这可能是因为我是RoR的新手。 谢谢,约翰

会话是否可以在Heroku上使用多个web dynos?

如果您在Heroku上运行带有多个Web dynos的Rails 3应用程序, 每次你点击应用程序,你通常会连接不同的网络动态? 会话可以在不同的网络动态中工作吗? 它适用于不同的Rails会话存储(ActionDispatch :: Session :: CookieStore,ActiveRecord :: SessionStore和ActionDispatch :: Session :: CacheStore)

CanCan – 访问被拒绝 – 制作CanCan的方法在LOG中指定为什么?

我正在努力实施CanCan。 出于某种原因,当我尝试获取有关模型权限的具体信息时,CanCan会一直拒绝访问Access。 我无法弄清楚为什么。 有没有办法让CanCan具体化,可能在日志或开发中关于为什么Access被拒绝? 像XXX模型没有读取能力。 这对调试很有帮助。 谢谢

如何使用redirect_to将hash参数添加到url?

如何使用redirect_to将hash参数添加到url? 例如: http:// localhost / products /#{page:2 }

错误:未知提供者:aProvider < – a

我在带有资产的Ruby on Rails 3.2.8项目中使用AngularJS。 当我在我的开发机器上加载使用AngularJS的表单时,我没有问题。 但是,当我在生产服务器上加载相同的表单时,我在Javascript控制台中收到此错误: Error: Unknown provider: aProvider <- a 我已将其追溯到我的coffeescript文件,我在其中设置AngularJS以便在表单中使用: $ (event) -> $(“#timesheet_description”).autocomplete({source: ‘/autocomplete/work_descs’}) # Create AngularJS module app = angular.module ‘timesheetApp’, [] # Create a AngularJS controller app.controller “TimesheetCtrl”, ($scope) -> $scope.costed_amount = 0 # Bind my module to the global variables so I can use it. angular.bootstrap document, [“timesheetApp”] […]