In http://www.aidanf.net/rails_user_authentication_tutorial there is the string/method protected in the model. What does it do? Can''t find that in http://api.rubyonrails.org/. -- Posted via http://www.ruby-forum.com/.
This is OOP visibility encapsulate mechanism. Learn more at: http://en.wikipedia.org/wiki/Object-oriented_programming. On 7/6/06, P?l Bergstr?m <pal@palbergstrom.com> wrote:> In http://www.aidanf.net/rails_user_authentication_tutorial there is the > string/method > > protected > > in the model. What does it do? Can''t find that in > http://api.rubyonrails.org/. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Everton J. Carpes Mobile: +55 53 9129.4593 MSN: maskejc@gmail.com UIN: 343716195 Jabber: everton.carpes@jabber.org Gestum http://www.gestum.com.br/ O.S. Systems http://www.ossystems.com.br http://projects.ossystems.com.br
Everton J. Carpes wrote:> This is OOP visibility encapsulate mechanism. > Learn more at: > http://en.wikipedia.org/wiki/Object-oriented_programming. >thanks :-) -- Posted via http://www.ruby-forum.com/.
Protected methods can only be invoked via the class itself (and friends). Practically, in rails controllers, this means the method can''t be accessed via the web. P?l Bergstr?m wrote:> Everton J. Carpes wrote: > >> This is OOP visibility encapsulate mechanism. >> Learn more at: >> http://en.wikipedia.org/wiki/Object-oriented_programming. >> >> > > thanks :-) > >
P?l Bergstr?m wrote:> In http://www.aidanf.net/rails_user_authentication_tutorial there is the > string/method > > protected > > in the model. What does it do? Can''t find that in > http://api.rubyonrails.org/.It''s a feature of Ruby, not of Rails. Within a class definition, it marks the following methods as protected (i.e. accessible to that class and its subclasses, not accessible to other classes). ''public'' (accessible to any class) and ''private'' (accessible only to this class) work similarly. In Rails controllers you should take care to make methods that are not to be used as actions via HTTP either private or protected. regards Justin
Inge J?rgensen wrote:> Protected methods can only be invoked via the class itself (and > friends). > > Practically, in rails controllers, this means the method can''t be > accessed via the web.Not sure I follow. -- Posted via http://www.ruby-forum.com/.