Displaying 20 results from an estimated 3000 matches similar to: "method_missing"
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
declarated.
Is that a normal behaviour?
Thanks
Andrea
--
You
2006 Aug 06
2
help with method_missing in ActiveRecord
I am serializing a data 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
2007 Feb 26
2
undefined method ... from `alias_method'
0 wicked var/www % ./script/console
Loading development environment.
>> r = Recipe.find :first
NameError: undefined method `recipe_type='' for class `Recipe''
from ./script/../config/../config/../app/models/recipe.rb:
101:in `alias_method''
In recipes_controller:
alias_method :orig_recipe_type=, :recipe_type=
def recipe_type=(t)
if t.nil?
2006 May 19
2
Help with using method_missing to create template path
I have a site (for an academic conference) that I want to convert to RoR
- both as a learning exercise and to ease further updates and
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
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 ==
2010 May 14
1
passenger and apache: worker or prefork
i''m going to install apache and passenger on a intel atom dual (dual
core).
is it better to install apache-worker or apache-prefork?
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send
2006 Nov 17
5
[Tweaking-Typo-4.0.3] acts_as_ferret `method_missing''
Hey Folks,
after following the instructions for tweaking Typo to use rather ferret
than DB queries to search article I got a strange NoMethod error when
starting the console or the server scripts.
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1129:in
`method_missing'':NoMethodError: undefined method `acts_as_ferret'' for
Content:Class
As you can
2006 Sep 11
15
ruby method names
Hi
Attached is a patch that adds aliases to the API for methods that look
like attribute accessors. So
a_frame.set_title(''The title'') # currently
a_frame.title = ''The title'' # now an alternative
textctrl.get_value # currently
textctrl.value # now an alternative
Also, C++ methods named ''IsXXX'' are now exposed in ruby with
2006 Mar 03
7
Meta Programming Help
I have the following two methods:
def ProductFile::find_images(mode, prod_id)
# convert to symbol in case it is not (most commonly it may be a String)
mode = mode.to_sym
case mode
when :all, :first
ProductFile::find(mode, :conditions => ["product_id = ? AND
file_type LIKE ?", prod_id, "image%"])
end
end
def ProductFile::find_documents(mode,
2009 Nov 23
8
Beginner's challenge
Hello,
I begun my journey in Ruby on Rails last Saturday and I am having some
challenges specifically about the db
Where should I go for the specific error listing and how it may be
resolved. I googled and most that I''ve searched are not helpful.
D
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2006 Jul 02
7
Generic SingleTable inheritance
Hi all,
I would like to discuss a design idea I have in mind with you, in order
to get critical feedback.
ActiveRecord supports single table inheritance(STI) "per se", BUT you
must add all possible instance variables(properties) of all subclasses
to the "base table"(as columns). I would like to circumvent this
restriction.
Say we have a
class AbstractGenericThing <
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''
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 subscribed to
2010 Jul 10
0
`method_missing': undefined method `i18n' for #<Rails::Railtie::Configuration:0x000001010fce98>
I have recently upgraqded to Ruby 1.9.2-rc1 and reinstalled rails 3
beta 4 with all the dependencies. I have run bundle install in my
rails project. Now I am trying to run some tests...
My test_helper.rb file looks like this:
# test_helper.rb
require ''rubygems''
require ''test/unit''
require ''rails/all''
$ gem list
i18n (0.4.1, 0.3.7)
2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi,
Is there an easy way of querying an active record for a maximum column
value? I need to do queries like:
SELECT MAX(salary) FROM employees
TIA,
Jeroen
2006 Feb 15
2
Polymorphic joins work one way, but not the other
I''ve been using polymorphic joins from edge rails based on about 5 lines
of advice Rick Olson gave me over IRC. There''s some sparse documentation
popping up but it seems to cover a somewhat different case.
Anyway - I pretty much got it to work - save for one detail. Here''s what
I have:
class Event < ActiveRecord::Base
belongs_to :attachable, :polymorphic =>
2007 Aug 09
3
method_missing error......need some eyes for this one
Working through the tutorials in the RailsSpace book, and cannot
figure out what I am doing wrong here. Full code for the edit function
which is tossing the error as well as appropriate code from the model
the actual error are pasted below.
Thank you for your help.
Dave
____________________________________________________________________
NoMethodError in UserController#edit
private method
2007 May 10
13
Is there a way to do incremental search?
Say the user first enters "ruby" for search and gets 1000 results. Then
he can search "rails" just in the 1000 results just returned.
The common scenario is some kind of advanced search. User can
incrementally add criteria and the program will narrow the results step
by step.
I know that at least I can use all the criteria as a whole to do the
searching, but this is a waste
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 when I trigger an assert, the
backtrace shows something like:
2006 Oct 27
8
Error after moving to production server
so i have an after_create method on my track model that kicks off a
background process that converts an mp3 to a swf.
this is working fine locally on my machine, but upon moving it to my
production server, i am getting the following error. I''ve only been
using backgroundRB for like 48 hours, so i''m not really sure what
this means or where to go. any ideas?