What is the use of ''abstract_method'' in rails? --Rahul -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jul 1, 6:01 am, Rahul P s <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> What is the use of ''abstract_method'' in rails?http://www.noobkit.com/show/ruby/gems/io/rio/module/abstract_method.html defines it as: "abstract_method(symbol, …) extends Module defines a method which raises AbstractMethodCalled used in a base class to ensure that subclasses define an implementation" --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It is used to cap the parent class of an inheritance. so if class Foo < Bar and Bar.some_method you want it to have to be defined in all subclasess (Foo and others...) you do like such: class Bar def some_method abstract_method end end then all subclasses must implement some_method or it will complain when being called (Note, untill it is called, everything is sweet, this can casue bugs...) On Jul 1, 1:32 pm, Matt Darby <m...-0eUD8CxtpZOb3c84sXp8cg@public.gmane.org> wrote:> On Jul 1, 6:01 am, Rahul P s <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > What is the use of ''abstract_method'' in rails? > > http://www.noobkit.com/show/ruby/gems/io/rio/module/abstract_method.html > defines it as: > "abstract_method(symbol, …) extends Module defines a method which > raises AbstractMethodCalled used in a base class to ensure that > subclasses define an implementation"--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---