>
>
> But there is no predefined accessor method called "weight". Some how,
> I must catch this. I've got two ideas, of which I'm not sure whether
> they make sense and can be implemented:
>
> 1. The accessor methods are created dynamically at runtime, so that
> they internally access the annotation data and return what they've
> found or "nil".
>
> 2. A kind of "catch-all"-method which takes the name of the methode,
> which we try to call, as a parameter. Some pseudo-code:
>
> catchAll(nameOfDesiredMethod)
>  FindAnnotation(nameOfDesiredMethod) // returning attribute value or
> nil
> end
>
> I don't know, if there's a known technique for this kind of problem.
> But I know, that there's something similar, if you look at the
> ActiveRecord find() method. There you can say find_by_attribute, for
> example.

ActiveRecord does exactly this for database attributes you might find  
nosing around in there is useful. The magic method you are looking for  
is method_missing.

Fred
>
>
> It's hard to explain, I did my best.
>
> Thank you for your suggestions!
>
> Best wishes,
> ms
> >


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to