search for: id2nam

Displaying 4 results from an estimated 4 matches for "id2nam".

Did you mean: id2name
2006 Nov 16
2
dynamically adding static (class) methods to a class
...s more of a Ruby question, but here goes anyways... I want to intercept all calls to non existent class methods and then call an existing class method with the non existent name. In code... class MyModel < ActiveRecord::Base def MyModel.method_missing(symbol, *args) MyModel.func(symbol.id2name) end def MyModel.func(func_called) puts "You called #{func_called}" end end When I try this code, it gets lost in recursion. Thanks for the help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Grou...
2006 Jul 24
1
meantime_filter won''t pick up my missing methods
<code><pre> module Scope protected def method_missing(method_id, *arguments, &block) if method_id.id2name =~ /^scope_([_a-z]\w*)_to_([_a-z]\w*)/ scope_model($1.singularize.capitalize, "#{$2}_id", &block) else super end end def scope_model(klass, foreign_key, &block) eval(klass).with_scope({ :find => { :conditions => [ "#{f...
2006 May 16
0
Possible bug: ActiveRecord::Base::has_many fails for String arguments.
...FoundError: ActiveRecord::HasManyThroughAssociationNotFoundError class Country < ActiveRecord::Base has_many :country_products, :dependent => true has_many "products", :through => :country_products end >> Country.find_all.first.products NoMethodError: undefined method `id2name'' for "products":String class Country < ActiveRecord::Base has_many :country_products, :dependent => true has_many :products, :through => "country_products" end >> Country.find_all.first.products ActiveRecord::HasManyThroughAssociationNotFoundError:...
2006 Mar 19
4
function names contain regex?
Is it possible to support something like the following: def validate_address{#/d/#) x = {#1} miscfunction(x) end And yes, I totally just made up some bogus syntax - I have no idea if a variable function name containing a regular expression is possible... perhaps through some trick of aliasing? I figure it must be possible, due to the model.find_x_and_y() methods in ActiveRecord.