Displaying 20 results from an estimated 700 matches similar to: "Mysterious interaction between RSpec 1.1.4 and has_finder/named_scope"
2008 Jun 12
0
named_scope doesn''t check for critical method names.
I just entered this ticket.
http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/404-named_scope-bashes-critical-methods
It turns out that in an ActiveRecord model like this
Model << ActiveRecord::Base
named_scope :public
private
def private_method
end
public
def public_method
end
end
The method public_method will be private because named scope
2008 Apr 04
0
named_scope and ordering
Hi,
this is a general design question and I liked to see how other people
handle the following situation: Before named_scope I wrote custom
finders for my model classes. Something like
# order.rb
class Order < ActiveRecord::Base
class << self
def find_all_marked
find(:all, :conditions => {:marked => 1}, :order => ''name ASC'')
end
end
end
Now
2010 Nov 03
0
Accessing (updating?) the proxy_scope chain for named_scope (Rails 2.3.x)
I have many named_scopes chained together in the normal way. So far
so good. However in a couple of cases where:
1. The named scope is actually a correlated subquery and I need to
pass additional scope into it sometimes.
2. Where the presence of a named scope in the chain should change the
behaviour of a named_scope later in the chain
Given: Product.price.volume.average_discount
2009 Jul 23
11
Problem with named_scope
Here are my scopes:
default_scope :order => ''posted_on DESC'', :conditions => { :status =>
''visible'' }
named_scope :positive, :conditions => { :rating => ''positive'', :status
=> ''visible'' }
named_scope :neutral, :conditions => { :rating => ''neutral'', :status
=>
2010 Sep 01
4
deprecation warning in Rails 3 about Base.named_scope
I recently upgraded to Rails 3, and this error has come up
ubiquitously:
DEPRECATION WARNING: Base.named_scope has been deprecated, please use
Base.scope instead.
Any ideas on how to get rid of it? Or should I just wait for
something?
There''s actually no place in my application where the code
"Base.named_scope" exists, so I assume the problem is inherent in gems
that
2009 Jul 11
2
offeride :limit named_scope default_scope
Hi,
Rails 2.3.2
class TestD < ActiveRecord::Base
default_scope :limit => 12
named_scope :limit, lambda { |num| { :limit => num} }
end
ruby script/console
>> TestD.all
TestD Load (0.7ms) SELECT * FROM "test_ds" LIMIT 12
=> []
>> TestD.limit(14)
TestD Load (0.3ms) SELECT * FROM "test_ds" LIMIT 12
=> []
Any ideas why the default limit
2008 Jul 20
0
eager loading a named_scope
Hi,
I''d like to eager load a named_scope like this:
User.find(params[:id], :include => [:friends.married])
Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To
2010 Jan 05
2
Conditional named_scope chaining with params (Need help)
Hello there,
I have a model that has more then one named_scope.
In my action Index of the controller that handle this model I want to do
this in a drier way:
if params[:ownership] == "mine"
@posts = Post.tagged_with(params[:tags], :on =>
:tags).owner(current_user.id).paginate :all, :page => params[:page],
:order => ''created_at DESC''
else
2008 May 13
6
Testing that named_scope is defined
Hi guys,
I''m just beginning to use RSpec and I ran into the issue of testing a
named_scope. I''m not actually trying to test its behavior, as it''s not
my code, but I wanted to test at least that it''s defined. I tried
doing this:
describe Post, ".most_recent" do
it "should be defined" do
Post.method_defined?(:most_recent).should be_true
2008 Jan 29
3
I thought the RSPec community might be interested
in my latest blog posting
:http://talklikeaduck.denhaven2.com/articles/2008/01/29/why-i-dont-mind-using-rspec-in-fact-ive-come-to-love-it
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
2010 Apr 28
0
Route globbing in Rails 3 beta 3
I was just playing around with the new routing dsl to answer someone''s
question on the general rails forum.
I wanted to see how Rails3 handled globbed routes. So I added this
to routes.rb
get ''forum/*path'' , ''forum#show''
And had the show action just display the params.
with a URL of /forum/a/b/c
I got {"path" => "a/b/c"}
2009 Oct 23
1
Anyone using the rspec textmate bundle with Ruby 1.9.1
I''m now in the process of facing converting a rails app to use Ruby 1.9.1.
Has anyone figured out how to use 1.9 with the RSpec bundle in
textmate and preferably how to switch back and forth?
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn:
2009 Oct 30
1
Any pioneers who've configured passenger to support some apps running in 1.8.x others in 1.9?
Passenger configuration selects which ruby executable to use via a
global configuration variable (at least for Apache, I assume it''s the
same for Nginx).
I''m in a situation where I''ve got at least one rails app I''d like to
run on 1.9 while others remain on 1.8. This is for my development
machine running OS X 10.6. Normally I just use the Passenger PrefPane,
2011 Apr 07
0
accepts_nested_attributes_for, validations, :inverse_of option on associations, and IdentityMap
This feels more like a question to ask the core list, forgive me if I trespass.
I''ve been trying to help one of my cow orkers get through a sticky
problem. He''s got a fairly complex nested form to update a model and
its children. He''s started adding some validations, and we''ve
encountered a number of issues:
First he had a validation on one of the child
2009 Jun 30
0
ri_cal 0.7.0 Released
Subject: [ANN] ri_cal 0.7.0 Released
ri_cal version 0.7.0 has been released!
* <http://ri-cal.rubyforge.org/>
* <by Rick DeNatale>
A new Ruby implementation of RFC2445 iCalendar.
The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide
for parsing and generating icalendar files,
but do not support important things like enumerating occurrences of
repeating events.
This
2010 Jul 07
1
Ticket 5063: Typo in named_scope in activerecord tests category.rb
Hey all,
Does someone want to look over a super-trivial patch I just
submitted? It''s just correcting a typo; someone accidentally spelled
"group_by_title" as "gruop_by_title" in the category.rb model in the
activerecord tests. I just fixed it in the model, and in the two
places it''s referenced in the habtm test.
Thanks,
Ben
--
You received this message
2010 Mar 09
1
Ruby 1.9 and Searchlogic problem
Hello,
After updating our Rails app to ruby 1.9 there are some problems with
searchlogic, here you can find the error :
Error : wrong number of arguments (1 for 0)
Full trace ( passenger ) :
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/named_scope.rb:92:in
`call''
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-2.3.5/lib/active_record/named_scope.rb:92:in
2010 Jan 15
1
Chaining queries in ActiveRecord
Hi all,
Stuck at this problem for several days. Tried to use named_scope,
scope_out, and plugin such as searchlogic, but no result.
The problem is as follows: I have a pic table and tag table, and a
join table called pic_tag (with only pic_id and tag_id) so that I can
associate N pics to M tags. This is the tutorial way to set up a many-
to-many association. I''m trying to implement a
2008 May 05
0
Do message expectations work in story steps?
I''ve never tried to use them myself, but another list member brought
this up in another thread.
He was using a message expectation in a story step, and couldn''t get it to fail.
Looking at what he was doing, it didn''t look to me that it would ever
succeed, which got me thinking.
Message expectations are implemented in rspec by asking the mock
framework to verify them
2008 May 16
3
Which rspec for rails 2.1RC1?
I''m working on porting our app. Do I need to upgrade rspec from 1.1.3?
If so which version.
BTW the installation doc at
http://rspec.info/documentation/rails/install.html seems to be stuck
in the pre-git days.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/