Displaying 20 results from an estimated 3000 matches similar to: "RSpec 2: uninitialized constant - mocking belongs_to AR relation"
2011 Jan 02
3
undefined method `run_all' for :Array
I''m using the latest ruby 1.9.3-head and recently whenever I run rspec
(2.2+) I get the following error:
I have seen others have run into this issue, but to resolve it just
rolled back to a previous version of rspec or it there a better way?
ruby-1.9.3-head/gems/rspec-core-2.3.1/lib/rspec/core/hooks.rb:116:in
`run_hook_filtered'': undefined method `run_all'' for []:Array
2010 Jan 18
2
Can't get gem bundler to work with either rvm 1.9.1 and 1.9.2
I installed the bundler, no problem - but it seems to have screwed up
my gem repository in both cases!?
What to do?
kristian-mandrups-macbook-pro:~ kristianconsult$ sudo gem install thor
/Users/kristianconsult/.rvm/gems/ruby/1.9.1/gems/bundler-0.8.1/lib/
rubygems_plugin.rb:2:in `require'': no such file to load -- bundler/
commands/bundle_command (LoadError)
from
2010 Jan 20
2
Rails 3 Problem: no such file to load -- rails (LoadError)
I just ran the gem bundle on the third_rails demo app, but for some
reason rails can''t be loaded!?
kristian-mandrups-macbook-pro:third_rails kristianconsult$ rails -v
Rails 3.0.pre
kristian-mandrups-macbook-pro:third_rails kristianconsult$ script/
generate model Post name:string
/Users/kristianconsult/my_rails/rails3_apps/third_rails/config/boot.rb:
71:in `require'': no such
2010 Jan 20
1
CRITICAL: Rails 3 error : parser.bundle unhandled exception!!!
kristian-mandrups-macbook-pro:rails3_apps kristianconsult$ rails my_r3
create
create README
create .gitignore
create Rakefile
create config.ru
create Gemfile
create app
...
kristian-mandrups-macbook-pro:my_r3 kristianconsult$ script/console
/Users/kristianconsult/.gem/ruby/1.8/gems/json-1.1.9/ext/json/ext/
parser.bundle: unhandled exception
2010 Jul 10
0
`method_missing': undefined method `i18n' for #<Rails::Railtie::Configuration:0x000001010fce98>
I have recently upgraqded to Ruby 1.9.2-rc1 and reinstalled rails 3
beta 4 with all the dependencies. I have run bundle install in my
rails project. Now I am trying to run some tests...
My test_helper.rb file looks like this:
# test_helper.rb
require ''rubygems''
require ''test/unit''
require ''rails/all''
$ gem list
i18n (0.4.1, 0.3.7)
2010 Feb 25
0
Rails problems running rake and other tasks - undefined method `action_controller'
I suddenly have a major problem in all my Rails 3 apps:
$ rake db:migrate --trace
rake aborted!
Don''t know how to build task ''db:migrate''
/Users/kristianconsult/.rvm/gems/ruby-1.9.1-p378/gems/rake-0.8.7/lib/
rake.rb:1728:in `[]''
/Users/kristianconsult/.rvm/gems/ruby-1.9.1-p378/gems/rake-0.8.7/lib/
rake.rb:2050:in `invoke_task''
2010 May 10
3
Using Rails 3 edge to circumvent current_period bug?
I get an error using Rails 3 beta3 on Ruby 1.9.2-preview1
undefined method `current_period'' for nil:NilClass (NoMethodError)
This commit should fix it
http://github.com/rails/rails/commit/a0cc94b32e5b4e4dce50787eed1208406f99ea82
But I forgot how to ensure I am running on edge with Rails 3.
Is it a special bundler command I need to use?
Thanks!
--
You received this message because
2010 Aug 30
1
in a rails3 - rspec then require 'authlogic/test_case' and now I broke stuff?
I''m a newb here and probably shouldn''t be using Rails3 yet to start with,
but for some reason I was feeling adventurous.
I''m also learning to use rspec along the way and things ''were'' working out
with my ''rake spec'' until I tried to follow some examples for test
Authlogic with rspec.
I ''think'' what started the
2010 May 12
8
Trouble developing Rails plugins/gems with generators
Hi,
I''ve been trying to develop a Rails gem/plugin with generators for
Rails 3. I first had a separate gem project with a gem statement in my
Gemfile with a :path option to point at it. But then I had to run $
rake install on each change in my gem to have Rails pick up on it. I
have now instead put my generators inside RAILS_ROOT/lib so they are
easier to test/develop.
lib/generators
-
2006 Jun 29
4
Multiple belongs_to
Let''s say I have a catalog with hotels. Each hotel belongs to a
category (4-star, 5-star etc.) This is it''s official category.However,
there is also a category that users assign and a category that
"independent reviewers" assign. So I have this:
hotels {
id,
category_id,
reviewer_category,
user_category
}
categories {
id,
name
}
class Hotel <
2009 Aug 10
1
Call AR belongs_to association accessor ID method on object assignment
Hi,
Haven''t been able to find this raised before but I''m sure it must have
been. When assigning an object to a belongs_to association I would
like it to call the *association*_id= method instead of directly
updating the attributes array. This is because I want to modify the
behaviour when assigning a particular object without writing separate
methods for whether it''s
2005 Dec 14
5
belongs_to and multiple foreign keys
Hi all,
I''m confused about how I''m supposed to specify a belongs_to relationship when
the table includes multiple columns that reference the same parent table.
In my case I have a "schedules" table with "opened_by" and "closed_by" columns,
that both reference the "users" table. In theory, they can be two different
user ids.
table
2010 Oct 06
2
rspec2 observations
Just a few observations now that I have completed the upgrade from RSpec-1 to RSpec-2.
1. In my project (2800 examples across about 40 files), MRI 1.9.2-p0 takes roughly 3 times longer to complete the spec run. Runtimes grew from 2.2s (rspec 1.3.0) to 6.1s (2.0.0.rc).
2. Rubinius 1.1.0 runs RSpec-2 without error.
3. JRuby 1.5.1 runs RSpec-2 without error.
4. Both Rubinius and JRuby print a
2009 Dec 26
3
Does :class_name for belongs_to have to be a string and why?
Seemingly, when I use a symbol, I get an ActiveRecord error stating
''Can''t convert symbol into String.'' Why can''t I use a symbol here?
Possibly this is a deeper misunderstanding of symbols in general on my
part.
#ActiveRecord error
class Book < ActiveRecord::Base
belongs_to :author, :class_name => :Person, :foreign_key
=> :author_id
end
#works
2007 Oct 08
7
belongs_to association doesn't work with _id set
Hello there,
I''m developing an application which has models like this:
class Vehicle < ActiveRecord::Base
belongs_to :internal_dim, :class_name => "Dimension"
def before_create()
idim = Dimension.create
self.internal_dim_id = idim.id
#self.create_internal_dim # Doesn''t work
end
end
class Dimension < ActiveRecord::Base
2006 Feb 27
4
2 belongs_to to the same parent table
Hello!
I have 2 table: users and buddies
User: id, name, ...
Buddy: id, user_id, user_buddy_id, ...
So if you have 2 users 1,jack and 2,fred and fred is a buddy of jack,
there is a Buddy object: id=1, user_id=1, user_buddy_id=2
I can declare only one belongs_to in Buddy and one has_many in User. And
there is conflict if I had the second one (the first one is discarded)
class User
has_many
2006 Apr 07
5
Confusion about has_many / belongs_to ...
I have a table called players and its model Player, and I have a table
called games and its model Game.
In the games table I have:
player1_id int(11)
player2_id int(11)
I want the tables to be associated so that I can access the player
objects using table.player1 and table.player2 rather than having to
lookup the objects based on the ids.
I am not sure how to go about this but I suspect I
2006 Apr 25
3
belongs_to and has_many
I know this has been rehashed many times, but I don''t get it.
I can''t find it documented to were I understand all the parts. I can
make this work using Rails database design conventions, but in this case
I am not able to do that.
I find examples, but the ones I find do not follow the conventions.
They also do not give enough information to understand what is going on.
In
2006 Jan 20
1
stack level too deep from has_many / belongs_to relationship
I have the following 3 models (2 models joined by an intermediate):
1. class Exercise < ActiveRecord::Base
2. has_many :routines, :class_name=>''RoutineExercise''
3. end
1. class Routine < ActiveRecord::Base
2. has_many :exercises,
3. :class_name=>''RoutineExercise'',
4. :order=>''position''
5. end
1. class
2008 Jun 12
1
unidirectional belongs_to polymorphic
The setup:
class Location::Base < ActiveRecord::Base
set_table_name :locations
...
end
class Location::Address < Location::Base
...
end
class Location::Airport < Location::Base
...
end
class Person < ActiveRecord::Base
belongs_to :location, :polymorphic => true, :class_name =>
"Location::Base"
...
end
I want a unidirectional belongs_to relationship. That