self refers to the current object.
Inside the class, self is used to define the class level method.
class Foo
def self.for(facebook_id)
User.create_by_facebook_id(facebook_id)
end
end
defines the class method for the Foo class. Called:
Foo.for(facebook_id)
You can google for class methods to find out more.
It is possible that part of the Rails or plugin / gem expects some classes to have a class for method. More context would be helpful in this regard.
, . , ActiveRecord "create", , . , User.create User, .
"create_by_facebook_id", User .
, "for" , , , ( User.create_by_facebook)
:
, Ruby- . , , facebook_id.