ruby-on-rails-3.1

“Uninitialized constant” error when including a module

自闭症网瘾萝莉.ら 提交于 2020-01-20 13:31:14
问题 I am trying to reference an association extension but it errors with: NameError (uninitialized constant User::ListerExtension): app/models/user.rb:2:in `<class:User>' Here is my implementation: app/models/user.rb class User < ActiveRecord::Base include ListerExtension has_and_belongs_to_many :roles, :uniq => true, :extend => Lister lib/lister.rb module ListerExtension def lister self.map(&:to_s).join(', ') end end I am using Rails v3.1.3. 回答1: Andrew Marshall has an excellent point about the

Creating a new rails 3 project over a proxy in windows

蹲街弑〆低调 提交于 2020-01-16 20:57:34
问题 My computer works on a proxy. So in order to install gems I use the following command gem install -p http//#{proxy-server}:#{port} rails If i use the normal gem install command, I get an error could not find gem . I installed rails 3.1 today and tried to create a new project. Half the way while creating the files, the generator started executing run bundle install and ended up giving the same error Fetching source index for http://rubygems.org/ Could not reach rubygems repository http:/

Failed to build gem native extension ruby racer gem of different version

感情迁移 提交于 2020-01-16 01:31:29
问题 I copied the application from production and did bundle install to install all the missing gems that are in production version and not on my local machine. Gem.lock file has the rubyracer version '0.10.1'. So when it tried to install this version using bundle install following error appeared. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb *** extconf.rb failed *** Could not create Makefile due to

Failed to build gem native extension ruby racer gem of different version

空扰寡人 提交于 2020-01-16 01:31:11
问题 I copied the application from production and did bundle install to install all the missing gems that are in production version and not on my local machine. Gem.lock file has the rubyracer version '0.10.1'. So when it tried to install this version using bundle install following error appeared. Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/user/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb *** extconf.rb failed *** Could not create Makefile due to

How to troubleshoot silently failing js in Rails?

六眼飞鱼酱① 提交于 2020-01-15 06:26:08
问题 It should be noted that I am not very proficient at using Firebug, but I haven't found any errors that explain the following issue. I have a feed.js.erb file containing the following code: var $foos = $('<%= escape_javascript(render(@foos)) %>'); $('#container').append($foos); $('#pagination_button a').attr('href', '<%= feed_path + '?page=' + @page %>'); When this ajax call is made the second time , it appears to fail silently. I see the appropriate response in the Firebug console, but $foos

Cucumber `press button` failure (Capybara::ElementNotFound)

旧时模样 提交于 2020-01-15 05:41:07
问题 I'm a relative newbie starting up a new Ruby on Rails app. I started by following a combination of instructions at https://github.com/intridea/omniauth, http://www.communityguides.eu/articles/16, http://intridea.com/2011/1/31/easy-rails-admin-login-with-google-apps-and-omniauth?blog=company . At the point everything appeared to work correctly, I started to write my very first cucumber features and steps. I was able to get a couple of steps up and running, but I've been bogged down on a step

Permanent variable in Rails

ぃ、小莉子 提交于 2020-01-14 13:28:06
问题 Lets say that on top of my Rails app there is a bar with piece of text displayed - latest hot deal, scheduled downtime notfication, something like that. It's a single, on of a kind information that needs to be accessed on basically every request, and may be updated from time to time. What is the best way to achieve this? What I'd like to do is some kind of permanent global variable (accessible from controllers). It will be updated very rarely, so there's no problem if for some time after

Sunspot/Solr raketasks not loading in Rails 3 Mountable Engine

泄露秘密 提交于 2020-01-13 07:00:49
问题 I'm trying to add the sunspot_rails gem to my Rails Mountable Engine, so I can use Solr to do full text searches. Like it states in the README file I've added this to my Gemfile: gem "sunspot_rails" gem "sunspot_solr" Then I run rails g sunspot_rails:install which creates sunspot.yml in the config folder of my Rails Engine. To start sunspot I need to run: bundle exec rake sunspot:solr:start But that doesn't work, and gives me the following error message: rake aborted! Don't know how to build

Thinking sphinx doesn't start - “Failed to start searchd daemon”

一世执手 提交于 2020-01-12 07:33:27
问题 I try to start thinking sphinx on my server but it doesn't want to work. I do: $ rake thinking_sphinx:index && rake thinking_sphinx:start And i get: Generating Configuration to /vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf Sphinx 2.0.3-release (r3043) Copyright (c) 2001-2011, Andrew Aksyonoff Copyright (c) 2008-2011, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/vol/www/apps/ror_tutorial/releases/20120202111730/config/development

Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck

冷暖自知 提交于 2020-01-12 06:34:47
问题 gem install rails --pre ERROR: While executing gem ... (NameError) uninitialized constant Psych::Syck I can't seem to find any info on how to resolve this. Has anyone else had the same problem? I am using a newly created gemset in RVM with Ruby 1.9.2 回答1: I had exactly same problem on mac via RVM. Specifying version is the rescue for me. gem install rails --pre --version 3.1.0.rc1 update (2011-06-12) with rubygems 1.8.4, I can install rails 3.1.0.rc4 without specifying the version. 回答2: I had