similar to: Issues with dynamic finders ruby-1.8.4 / rails-1.0.0

Displaying 20 results from an estimated 4000 matches similar to: "Issues with dynamic finders ruby-1.8.4 / rails-1.0.0"

2006 Mar 22
2
Controller instance variables falling in and out of scope
Very bizarre behavior has cropped up in a few spots. # the action for viewing a blog post def posts @post = BlogPost.find_by_slug(params[:id], :include => :commentary) # a breakpoint here shows @post and @post.commentary with appropriate data redirect_to :action => ''archive'' unless @post end # posts.rhtml <%= @post.inspect %> => nil <%= render :partial
2005 Mar 05
3
routes inconsistency?
Hello, As a small excercise in learning rails, I''ve been porting a very simple website from SSI to rails (yep, a bunch of static files that were previously served with a tiny bit of SSI magic are now served by a database-backed rails, it''s total overkill, I know). Part of the reason is that I''m trying to move from apache to lighttpd, and lighttpd''s SSI for
2008 Sep 23
0
Questions on Active Record SQL type Finders & Dynamic Finder
Hi, I understand there are total 11 types of key Options for finding a record. The all 11 valid keys for the options hash are :conditions, :include, :order, :select, :group, :joins, :from, :limit, :offset, :readonly, and :lock. We also have Dynamic Finders for the same. e.g. ... find_by etc... I would like to know, how many types of dynamic finders, Active Record provides, to match all those
2008 Feb 07
1
field names, aliases and finders.
I can not seem to make finders work with aliases. My goal is to map some fugly field names to nice field names and have the finders work with the nice field names. An example. class Users < ActiveRecord::Base alias :password :UserPWD end This doesn''t seem to work because obviously the object doesn''t have a method called UserPWD. What is the best way (short of a view) to
2009 May 19
0
Extending finders to include a session variable as an option??
We have a Page model which acts_as_paranoid. AAP modifies ActiveRecord finders to ignore any records marked as deleted unless the :with_deleted => true option is supplied. We have a UI element which allows users to toggle whether or not to display deleted Pages, their current setting being stored in a session variable, session[:show_deleted]. What we would like is to automagically have
2007 Oct 26
1
Spec custom finders
I have some finders in my models where I write some of the sql myself. I of course want to test these, but am not sure the best way. Should I just let them roll through to the db, and verify they return the correct objects based on the fixtures I load, or should I spec the actual query? I know that DB access is sort of frowned upon, but is this a situation where it is more or less acceptable? My
2005 Dec 21
0
Dynamic Finders and Legacy Schemas
Hello everyone, I have another question related to a legacy schema I am working with. Do dynamic finders work with legacy schemas in general? The schema I am working with uses hungarian prefixes for column names. For example fOpen is 0 if a bug is closed and 1 if it is open (type smallint). When I try @bugs = Bug.find_all_by_fOpen(1), I get the following exception: undefined method
2011 Aug 23
2
Where is WillPaginate::Finders ???
Hi All! It''s been a while since I had to ask for help, but I''m back! I''ve finished beta testing my big app and started the transition to production. Everything went fine and the production version was working till I was asked to add another model :-( (Almost a year of beta testing and they only come up with it after moving to production :-D ) I successfully
2008 Apr 24
2
Dynamic finders in has_many associations
I have these 3 models. class Ivr < ActiveRecord::Base has_many :klusterings, :dependent => :destroy has_many :klusters, :through => :klusterings, :uniq => true end class Kluster < ActiveRecord::Base has_many :klusterings, :dependent => :destroy has_many :ivrs, :through => :klusterings, :uniq => true end class Klustering < ActiveRecord::Base belongs_to :kluster
2006 Jul 26
1
Polymorphic Associations: dynamic finders
Is there any sort of dynamic finder for polymorphic associations? For example if I had: class InviteNode < ActiveRecord::Base belongs_to :inviteable, :polymorphic => true end I would like to be able to search by: InviteNode.find_by_inviteable(some_object) instead of having to do: InviteNode.find_by_inviteable_id_and_inviteable_type(some_object.id, some_object.class.name) obviously I
2006 Jul 18
2
how to generate calculated db fields
I''m trying to generate a "page slug" i.e. a url sanitized id from some text in my model that I want to be saved into the database and I''m not seeing how I can do it. The closest I''ve come to getting this to work has been... class Page < ActiveRecord::Base attr :name before_save :generate_slug def generate_slug self.slug = self.name.gsub
2008 Feb 07
1
ActiveRecord 'find_or_initialize_by' dynamic finder bug? Ignoring conditions.
Hello all, I just ran into something that I think is a bug, and I would like to confirm with the core team whether this is expected/desired behavior or if this is a bug that I should file and develop failing tests for (I doubt I have the active record method_missing fu to actually patch it). Test Scenario: I would like to find or initialize a new user and base the find on the users email
2006 Nov 16
0
rsync-ssh problem
I am having a real nightmare getting automated login with ssh to work; hoping someone can guide me. I am running Ubuntu 6.10. I have a main machine (called greywolf) which has a partition for my /home on it. I am doing backups to an extrnal usb drive attached to a Linksys NSLU2 (called slug) running UnSlung firmware. All hosts, networking, shares, firewall & such stuff is working fine.
2006 Jan 05
8
Repost - Do dynamic finders work with legacy schemas?
Hello everyone, I have another question related to a legacy schema I am working with. Do dynamic finders work with legacy schemas in general? The schema I am working with uses hungarian prefixes for column names. For example fOpen is 0 if a bug is closed and 1 if it is open (type smallint). When I try @bugs = Bug.find_all_by_fOpen(1), I get the following exception: undefined method
2008 Jun 13
0
DRYing some controller code
def index if not @contest.nil? @videos = Video.paginate( :all, :include => { :ad => :contest }, :page => params[ :page ], :conditions => [ "videos.state = ''published'' AND contests.slug = ?", @contest.slug ] ) else @videos = Video.paginate( :all, :conditions => { :state => ''published'' }, :page
2003 Jul 28
1
joining samba domain 3-b3 with windows XP Pro
G'day all, I have Samba 3 beta 3 running on a RH9 box,(OpenLDAP backend) trying to make it a PDC. Everything seems to be working ok (see shares, browse etc) except I cannot add a machine to the domain. Windows XP Pro as the client, (registry settings changed) after I enter the admin user account details to join the domain I get the following error message... The user name could not be
2004 Nov 16
1
lme, two random effects, poisson distribution
Hello, I have a dataset concerning slugs. For each slug, the number of pumps per one time slot was counted. The number of pumps follows Bi(30, p) where p is very small, thus could be approximated by Poisson dist. (# of pumps is very often = 0) The slugs were observed during 12 time slots which are correlated in time as AR(1). The time slots are divided into two categories: Resting time
2006 Jun 20
3
return unique rows with finders
I''m looking through the api for something like find(:all, :distinct => true) so that multiple instances of a row won''t be returned - is this possible? Thanks!
2006 Mar 08
0
Unit tests dynamic finders
Hi all, I am having a problem with unit tests. Whenever I have a dependency between two models (B depends on A) deleting A should also delete B. This is simple with the dependent parameter in the model file of A. But when I write a test the dependency seems to work, I can''t find the answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it with
2006 Mar 14
1
Dynamic Finders with _or_create Don''t Work?
What could cause this? >> sdfl=PartNumber.find_by_part_number("1111111") => #<PartNumber:0xb78fc744 @attributes={"id"=>"11601", "part_number"=>"1111111"}> >> sdfl=PartNumber.find_or_create_by_part_number("1111111") NoMethodError: undefined method `find_or_create_by_part_number'' for PartNumber:Class