search for: method_missing

Displaying 20 results from an estimated 573 matches for "method_missing".

2006 Aug 06
2
help with method_missing in ActiveRecord
...object (FooData) into an ActiveRecord column (Foo). I''d like to be able to do delegate methods to the data class if the Foo class doesn''t have that attribute. So instead of: f = Foo.new f.data.item1 I''d like to do: f = Foo.new f.item1 I was hoping that I could add a method_missing method to my Foo class and call methods in the FooData class but I''m not sure how to go about doing that. In my example below, I get Stack Level too deep errors. class Foo < ActiveRecord::Base serialize :data, FooData def after_initialize self.data = eval("#{self.class}Da...
2010 Mar 18
3
method_missing
i''m using method_missing to implement a simple metaprogramming that checks for account rights. in Account << ActiveRecord::Base i defined: def method_missing(m, a = {}) if m.to_s =~ /^has_right_(.*)$/ ... calls another method passing $1 parameter end end it seems to override some of the active record methods...
2011 May 11
2
method_missing in controller
Hi, I am using a method_missing method into a controller. I have a route that says: match '':controller/:action'' What surprise me is that if a view that match the action name exists method_missing is not invoked but rails happily render the view. I was expecting that method_missing was going to be invoked if de...
2007 Jul 02
8
Strange intermittent no search results problem
Hello, First the specs: ruby 1.8.6, rails 1.2.3, ferret 0.11.4, mongrel 1.0.1, mongrel_cluster 0.2.1 And the model''s aaf config: # Ferret search engine acts_as_ferret({:fields => {:name => {:boost => 10}, :summary => {:boost => 2}, :body => {:boost => 1, :store => :no},
2006 Jul 30
8
Method_missing from Ruby for Rails book
I''m having a problem getting this example from the book to work: class Cookbook attr_accessor :title, :author def initialize @recipes = [] end def method_missing(m, *args, &block) @recipes.send(m, *args, &block) end end cb = Cookbook.new cb << recipe_for_cake cb << recipe_for_chicken beef_dishes = cb.find_all {|recipes| recipe.main_ingredient == "beef" } I''m getting callable.rb:14: undefined local variable or m...
2006 May 19
2
Help with using method_missing to create template path
...development. There are a number of child pages for each conference (past and future), but these pages are different for each conference (not same child pages for each conference). The URLs are along the lines of: /conference/2000/keynotes /conference/2003/papers Is it possible to have a method_missing in my ConferenceController that will take the "2003" and "papers" bits of the URL and display "/views/conference/2003/papers.rhtml"? I have added the following to my routes.rb map.connect ''conference/:year/:action'', :controller => ''...
2006 Oct 27
8
Error after moving to production server
...13135): /usr/lib/ruby/1.8/drb/drb.rb:570:in `load'' /usr/lib/ruby/1.8/drb/drb.rb:629:in `recv_reply'' /usr/lib/ruby/1.8/drb/drb.rb:918:in `recv_reply'' /usr/lib/ruby/1.8/drb/drb.rb:1192:in `send_message'' /usr/lib/ruby/1.8/drb/drb.rb:1083:in `method_missing'' /usr/lib/ruby/1.8/drb/drb.rb:1167:in `open'' /usr/lib/ruby/1.8/drb/drb.rb:1082:in `method_missing'' /usr/lib/ruby/1.8/drb/drb.rb:1100:in `with_friend'' /usr/lib/ruby/1.8/drb/drb.rb:1081:in `method_missing'' /app/models/track.rb:55:i...
2007 Sep 27
14
Camping and ruby2ruby
Hi everybody, I would like to use ruby2ruby in a caming project, but there seems to be an incompatibility with camping, ruby2ruby and markaby. Unfortunately I receive strange Markaby::InvalidXhtmlErrors. To demonstrate, that only combination of all three components causes the problem I added the following code. I relies on Markaby and ruby2ruby only and works fine (a.k.a. as expected).
2006 Jul 25
1
Managing backtrace
I''m writing a method_missing handler to "automagically" create assertions from predicate functions. So, for example, one use might be: assert_not_include ''joes@shmoe.com'', response.to -or- assert_include ''info@mydomain.com'', response.from The code is working properly, but whe...
2006 Jan 19
2
Easy way to handle form input without a model class?
...auto populating forms without a model, with or without rails helpers. If there''s no existing way to do this, I already have an idea for something simple. I''d write a class that takes a hash at initialization to populate instance variables and automatically add accessors, and use method_missing to handle the object before it''s initialized with the hash. Pretty easy..but I just wanted to see if something like this exists already. Thanks, Pat
2006 Mar 28
0
MySQL problems and undefined class User
...pack-1.12.0/lib/action_controller/code_generation.rb:99:in `move_forward'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/routing.rb:80:in `write_recognition'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/code_generation.rb:46:in `method_missing'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/code_generation.rb:19:in `indent'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/code_generation.rb:46:in `method_missing'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/li...
2005 Dec 20
1
Model method_missing error (rforum)
I''m attempting to get rforum working. I pulled it from the subversion repository. Everything works fine until I attempt to make a post. I get the following error. c:/apps/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1498:in `method_missing'' #{RAILS_ROOT}/app/controllers/topic_controller.rb:80:in `new'' c:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `send'' c:/apps/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `perform_action_wi...
2010 Sep 14
0
Model with method_missing - rails 3, ruby 1.9.2 raises exception
Say you have two models Post and Author. And Post has_many :authors Finally, method_missing is overridden in Author. Then if you do Post.limit(1).first << Author.limit(1).first You get an exception Author does not define :to_ary Or has there been a change in rails 3 that I have completely overlooked while migrating my app? -- You received this message because you are subscribe...
2010 Mar 01
0
undefined method for Polymorphic association using Searchlogic
...roject_id_equals(217).entry_type_equals("project") NoMethodError: undefined method `timesheet_enterable_task_type_project_id_equals'' for #<Class: 0x36bd660> from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/conditions.rb:88:in `method_missing'' from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/association_conditions.rb:19:in `method_missing'' from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/association_ordering.rb:27:in `method...
2010 Jul 10
0
`method_missing': undefined method `i18n' for #<Rails::Railtie::Configuration:0x000001010fce98>
...builder (2.1.2) from bundler gems Using i18n (0.4.1) from bundler gems ... Using railties (3.0.0.beta4) from bundler gems Using rails (3.0.0.beta4) from bundler gems $ rake test /Users/kristianconsult/.rvm/gems/ruby-1.9.2-rc1/gems/ railties-3.0.0.beta4/lib/rails/railtie/configuration.rb:76:in `method_missing'': undefined method `i18n'' for #<Rails::Railtie::Configuration:0x000001010fce98> (NoMethodError) from /Users/kristianconsult/.rvm/gems/ruby-1.9.2-rc1/gems/ activesupport-3.0.0.beta/lib/active_support/railtie.rb:36:in `<class:Railtie>'' from /Users/kristiancons...
2006 Feb 10
12
Accessing ''many'' variables
Hi, I have a class called Outlet which has_many Jacks. Apart from internal id, each jack is unique by the attribute ''color''. I''d like to iterate through each Outlet, and be able to output data for a Jack of a certain color. Say, I want to access the orange jack for the current outlet: <td><%=h outlet.jack.color[''O''].ip_address
2007 Apr 03
5
Inifinite loop problem with DRb server
...any)) end end # Backtrace stack level too deep (druby://127.0.0.1:3000) /usr/local/lib/ruby/1.8/drb/drb.rb:1649:in `current_server'' (druby://127.0.0.1:3000) /usr/local/lib/ruby/1.8/drb/drb.rb:1704:in `to_obj'' (druby://127.0.0.1:3000) /usr/local/lib/ruby/1.8/drb/drb.rb:1079:in `method_missing'' (druby://127.0.0.1:3000) /home/francois/src/xlsuite.org/vendor/plugins/acts_as_ferret/lib/remote_index.rb:25:in `id_multi_search'' (druby://127.0.0.1:3000) /home/francois/src/xlsuite.org/vendor/plugins/acts_as_ferret/lib/ferret_server.rb:69:in `send'' (druby://127.0.0.1:30...
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.
2007 Mar 27
6
how does rails do this "find_by_?"
Hello there, I''m wondering how do they create functions on the fly? find_by_any_column_name ?? I want to do something similar with my models, but I don''t really know how to do it? user_current_nickname user_current_id user_current_role etc.? Regards, Jamal -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this
2010 Mar 09
1
Ruby 1.9 and Searchlogic problem
...ondition_options'' /usr/local/lib/ruby/gems/1.9.1/gems/searchlogic-2.3.11/lib/searchlogic/named_scopes/association_conditions.rb:42:in `create_association_condition'' /usr/local/lib/ruby/gems/1.9.1/gems/searchlogic-2.3.11/lib/searchlogic/named_scopes/association_conditions.rb:16:in `method_missing'' /usr/local/lib/ruby/gems/1.9.1/gems/searchlogic-2.3.11/lib/searchlogic/named_scopes/association_ordering.rb:27:in `method_missing'' /usr/local/lib/ruby/gems/1.9.1/gems/searchlogic-2.3.11/lib/searchlogic/named_scopes/ordering.rb:30:in `method_missing'' /usr/local/lib/ruby/g...