Search code examples
ruby-on-railsrubyruby-on-rails-4thisself

Is there a "this" object in Ruby on Rails?


I am a front end developer working mostly with javascript with a foundation in C/C++. Now I find myself working on RoR middleware for my company's Ruby on Rails team. Is there a "this" object in Ruby on Rails? For example: if I call user.method(), inside of the method's scope, can I reference the user object via "this.foo"... or would it be "self.foo"... or something entirely different? Thank you.


Solution

  • try this out:

    self is equal to this in ruby.You can get current object in context using self keyword.

    Read More about self keyword