Displaying 20 results from an estimated 1000 matches similar to: "Accessing (updating?) the proxy_scope chain for named_scope (Rails 2.3.x)"
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
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
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
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 Jun 12
0
Mysterious interaction between RSpec 1.1.4 and has_finder/named_scope
I just opened a Rails ticket on a problem with named_scope in Rails 2.1, and
cross-posted a message here which I send to rails-core.
I''m still a bit mystified, because I''m having a problem caused by this on
RSpec 1.1.4, but not on 1.1.3, and I don''t see a difference in code which
would explain it.
The basic problem, which I encountered upgrading our rails app to RSpec
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
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
2010 Mar 01
0
undefined method for Polymorphic association using Searchlogic
I am unable to call a polymorphic scope using the searchlogic plugin
as it keeps on returning ''undefined method''. I am certain it is only a
problem within my project as I created a test project and I was able
to call a polymorphic scope using the searchlogic plugin.
I am hoping someone can provide a suggestion on how to debug this
issue.
My project consists of several gems, and
2006 Jul 02
11
Rails Plugin: meantime_filter for controllers (actions within blocks)
Hello, I just finished writing a plugin for Rails that I''m annoucing
the first release here: meantime_filter.
It is descibed at http://roman2k.free.fr/rails/meantime_filter/0.1.0/
rdoc/
(See the end of this message for getting it.)
ABOUT THE PLUGIN
It extends ActionController to add the functionnality of having
filters run at the action call time. This new type of filter yields
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
2008 Jun 03
1
Custom counter cache
class Category
has_many :tracks
end
class Track
belongs_to :category, :counter_cache => true
named_scope :converted, :conditions => {:converted => true}
named_scope :active, :conditions => {:active => true}
end
I want to make custom counters for scoped associations, e.g:
category.converted_tracks_count
category.active_tracks_count
And when `track` changes its converted,
2009 Nov 01
1
please help - complicated polymorphic association
I am trying to build a shared-appointment system, where users can
subscribe to appointments and be updated whenever changes are made to
them. I have three objects in this system, appointments, users, and
subscribers. Subscribers are a polymorphic object like so:
class Subscriber < ActiveRecord::Base
belongs_to :user
belongs_to :subscribable, :polymorphic => true
end
The tricky part is
2009 Jul 20
2
Hitting unknown error with "can't dup NilClass"
Hi,
My system has been encounter this problem, and I couldn''t find
solution after debugging. My scenario is stated below:
class user
has_many :posts
has_many :comments
end
class post
belongs_to :user
has_many :comments, :as => :commentable
end
class comment
belongs_to :post
belongs_to :user
end
For this case, I am trying to retrieve each post''s comment
2009 Oct 17
2
Skip default_scope when running migrations
Hi,
I was wondering if there is a way to skip the application of a
named_scope to calls made in legacy migrations. I am working with some
old migrations that include some data manipulation tasks, and my default
scope is preventing those migrations from running. I''m trying to avoid
editing those migration files with with_exclusive_scope.
Thanks,
-G
--
Posted via
2006 Nov 21
2
Accessing scopes
If with_scope has been called previously, how do I access the find
conditions dynamically?
I am asking because I am using a find_by_sql call (which clobbers the
with_scope). How can I access the method scoping so that I can read it
and incorporate it into my query manually?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
2010 Jun 24
3
DRY a named scope
Is there a way to DRY this up a bit?
named_scope :has_valid_sysoid, lambda{|sysoid|
(sysoid.nil?) ? {:conditions => ["nodesysoid IS NOT NULL AND
nodelabel LIKE ''%-to-%''"], :include => [:ipinterface, :alarm]} :
{:conditions => ["nodesysoid IS NOT NULL AND nodelabel LIKE ''%-to-%''
AND nodesysoid = ? ", sysoid], :include =>