collintmiller
8/10/2007 6:45:00 PM
Found this:
-----------------
Not sure if this is the most elegant way, but:
define_method(:method_name) do |*args|
parameter, parameter2 = *args
parameter2 ||= 'default'
puts parameter
puts parameter2
end
-----------------
That'll do for now.
On Aug 10, 1:23 pm, Collin Miller <collintmil...@gmail.com> wrote:
> line 7: define_method("create_#{model_name}") { |attrs|
>
> Line 7 seems to be the problem line.
>
> I think I want to do this:
> define_method("create_#{model_name}") { |attrs={}|
>
> But I cannot. I can still use the defined method and not send it an
> argument, but then Ruby complains.