similar to: deprecation warning in Rails 3 about Base.named_scope

Displaying 20 results from an estimated 1600 matches similar to: "deprecation warning in Rails 3 about Base.named_scope"

2011 Jun 16
2
Authlogic: Trying to login in my Cucumber test - Authlogic::Session::Activation::NotActivatedError
In a Cucumber step definition, I''m trying to login, but I keep getting this error: You must activate the Authlogic::Session::Base.controller with a controller object before creating objects (Authlogic::Session::Activation::NotActivatedError) My code: Given /^I am the logged in (.+) "(.+)"$/ do |role, login| user = User.create!( :login => login, :password =>
2009 Dec 03
2
AuthLogic Question - one time password (persistence_token) - what config is required to use this???
Hi, I''m stuck trying to work this one out - have been reviewing the AuthLogic code base but having a hard time making sense of it ( http://github.com/binarylogic/authlogic ). Question 1 - Can anyone confirm what config exactly is required to make the one time password (persistence_token) work in AuthLogic? See below for the bulk... Question 2 - If not the full answer to the above,
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 =>
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 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 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 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
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
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
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
2012 Oct 16
5
`method_missing_without_paginate': undefined method `class_attribute' for ActiveRecord::Base:Class
hi i am using radiant 0.8.2 , rails 2.3.4, ruby 1.8.7 and rubygems 1.4.2. and i can''t able to run my existing application. error occurred : run command for server "script/server -e production -p 3001" error: => Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3001 config.gem: Unpacked gem rack-rewrite-1.2.1 in vendor/gems has no specification
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
2009 Aug 02
13
NoMethodError in User sessionsController#create - Authlogic
Hi, I''m beginner in rails, and I wanted to add to my simple application Authlogic. So I''ve watched http://railscasts.com/episodes/160-authlogic and step-by-step done everything. And almost everything works fine, except login in. After registration new user is automatically logged in, he can edit his profile, but after clicking logout and trying to login again I get error
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,
2010 Dec 22
8
Shoulda issue: no more "should have_instance_methods" ?
I''m using Shoulda. After copying the code here.... .... http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html.... into my test_helper file so I can test acts_as_list, I came across issues. For one I realized I had to get rid of the _ between the "should" and "have" in past cases, but here, I get this error when I run my unit test:
2010 Dec 15
2
skip password validation in authlogic
i am using authlogic for user authentication and authlogic-connect for facebook and twitter signup.what i need is that i need to skip validation on the password field if user is signup via facebook or twitter.my environment is rails 3 and ruby 1.9.2. i have acts_as_authentic in my user model.however i can skip phone number validation like this validates :phone_number, :numericality =>
2010 Dec 23
6
Difference between rake test:units and individually running ruby -I test test/unit/something_test.rb ?
Here''s my issue: running ruby -I test test/unit/something_test.rb for each of my unit tests works perfectly. However, running rake test:units brings errors in all of them - some object becomes nil for some reason. Why might this be happening? Specifics: the object that is successfully not nil when I run the unit tests one-by-one but becomes nil when I do rake test:units is defined like
2010 Dec 15
5
Having trouble testing :( "superclass mismatch" and can't load "test_helper"
I''m having trouble testing my Rails 3 application. Unit testing doesn''t work. If I try ruby article_test.rb directly, I get a "no such file to load" error, and if I try rake test:units or ruby unit/ article_test.rb I get this odd "superclass mismatch for class ArticlesController" error! I''m hoping I can get this settled... My test files were
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