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

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

Button_to使用POST Link_to使用GET,为什么? ROR

我使用link_to遇到了一个问题。 在link_to参数中指定我的“method”=>“post”后,为什么我的链接使用GET方法而我的button_to使用POST方法? 视图: ‘getquote’ %> ‘inventories’, :action => ‘getquote’, :method => :post } %> 控制器方法: def getquote @cart = find_cart respond_to do |format| format.pdf end end 终端输出(分别为按钮/链接): Processing InventoriesController#getquote (for 127.0.0.1 at 2010-01-30 01:38:02) [POST] Parameters: {“action”=>”getquote”, “authenticity_token”=>”D2cwnHyTHgomdUM3wXBBXlOe4NQLmv1Srn0paLbExpQ=”, “controller”=>”inventories”} Processing InventoriesController#show (for 127.0.0.1 at 2010-01-30 01:39:07) [GET] Parameters: {“method”=>”post”, “action”=>”show”, “id”=>”getquote”, “controller”=>”inventories”}

嵌套资源的表单

我已经完成了大量的form_for嵌套资源问题,无法让任何解决方案适合我。 我想是时候问一个个性化的问题了。 我有两个模型,工作和问题,工作有很多问题和问题属于工作。 我使用scaffolding创建控制器和模型,然后嵌套routes.rb中的资源。 root :to => “pages#home” resources :jobs do resources :questions end get “pages/home” get “pages/about” get “pages/contact” class Job < ActiveRecord::Base has_many :questions end class Question < ActiveRecord::Base belongs_to :job end 现在我正在尝试访问’/ jobs / 1 / questions / new’并继续获取 问题#new中的NoMethodError 当代码出现时,我开始使用错误No route matches {:controller =>“questions”} 我知道这是错的,所以我开始尝试其他组合,但没有一个工作。 我试过了 那 那 在一堆其他组合中,并没有工作。 这是我的rake路线的链接:git clone […]

Rails关联中的未知密钥

我有以下协会代码: has_many :rates_without_dimension, :as => :rateable, :class_name => “Rate”, :dependent => :destroy, :conditions => {:dimension => nil} has_many :raters_without_dimension, :through => :rates_without_dimension, :source => :rater has_one :rate_average_without_dimension, :as => :cacheable, :class_name => “RatingCache”, :dependent => :destroy, :conditions => {:dimension => nil} dimensions.each do |dimension| has_many “#{dimension}_rates”, :dependent => :destroy, :conditions => {:dimension => dimension.to_s}, :class_name […]

从Windows将rails应用程序连接到SQL Server 2005

我(遗憾地)必须在Windows XP上部署一个必须连接到Microsoft SQL Server 2005的rails应用程序。 在网上冲浪有很多从Linux到SQL Server连接的点击,但无法从Windows中找到如何做到这一点。 基本上我遵循以下步骤: 安装dbi gem 安装activerecord-sql-server-adapter gem 我的database.yml现在看起来像这样: development: adapter: sqlserver mode: odbc dsn: test_dj host: HOSTNAME\SQLEXPRESS database: test_dj username: guest password: guest 但我无法连接它。 当我运行rake db:migrate时,我得到了 IM002 (0) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 我不是Windows用户,因此无法理解dsn元素的含义。 有人知道如何解决这个问题吗? 提前致谢 现在我已经将Alexander.yml修改为: development: adapter: sqlserver mode: odbc […]

brew install redis(osx 10.7)

我尝试在bash上通过自制程序在osx 10.7上安装Redis,我收到以下错误: ==> Downloading http://redis.googlecode.com/files/redis-2.6.9.tar.gz Already downloaded: /Library/Caches/Homebrew/redis-2.6.9.tar.gz ==> make -C /private/tmp/redis-wQAX/redis-2.6.9/src CC=cc Error: Permission denied – /usr/local/var/db 我没有安装Redis。 $ ps -aux | grep redis ps: No user named ‘x’ 我找不到解决方案,也不知道该问谁! 如果您有解决方法或解决方案/建议,请告诉我。 谢谢!

Ruby on Rails,没有发现Rakefile错误

我在轨道上安装了ruby,postgres。 我安装了所有必需的gem文件,我创建了一个项目,如http://guides.rubyonrails.org/getting_started.html想要的 我在config / routes.rb中添加了以下代码 Blog::Application.routes.draw do resources :posts root to: “welcome#index” end 我正在尝试运行rake routes命令。 但我明白了 rake aborted! No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb) 我检查了互联网..每个人都说“我需要在确切的项目文件夹下运行它”。 但我需要说,我在Windows 7上尝试了近20个不同的文件夹。(我疯了) 我不知道你的专家需要什么,但是: 我用 : Windows 7旗舰版(64位)Ruby200-x64 rake-10.1.0 提前致谢..

Capybara需要睡觉吗?

显然,根据网页 更新 ,使用最新版本的wait_until , sleep或wait_until无效。 但是,如果我在测试中添加sleep(1)调用,我有一组仅适用于快速计算机的测试。 也就是说,测试看起来像: describe “dosimeters page” do before do click_link(“Dosimeter Read History”, :match=>:first) end … 变 describe “dosimeters page” do before do unix_wait click_link(“Dosimeter Read History”, :match=>:first) end … 我把unix_wait定义为: def unix_wait case RbConfig::CONFIG[‘host_os’] when /darwin/ when /linux-gnu/ sleep(1) end end 问题是,我有一台旧的Ubuntu 12.04四核笔记本电脑在Jenkins上运行这些测试,一切都运行良好,没有unix_wait调用。 测试在运行Ubuntu 13.10和macbook pro笔记本电脑的unix_wait桌面上随机失败,但如果我添加了unix_wait调用,则测试通过。 测试失败本身表示加载失败(即某些运行中缺少css元素,但其他运行中没有),并且当手动加载站点时,被测试的内容实际上有效。 那么这里适当的行动是什么? 显然,测试期间不允许sleep , wait_until也wait_until […]

使用CSS在erb中设置Ruby对象的样式

我用谷歌搜索但找不到这个问题的答案。 如何在erb中使用CSS编辑RUby对象。 例如: 在这里,我想使用CSS来设置文本和表单框的样式。 我怎样才能做到这一点?

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

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