menu

Imba

The language for building next-gen web applications

Channels
Team

Access class variable from constructor

June 20, 2019 at 6:34pm

Access class variable from constructor

June 20, 2019 at 6:34pm
Is there any way to access in the following example: https://scrimba.com/c/cgqGd7hP ?

June 20, 2019 at 6:43pm
How cool is that? Imba is awesome!
  • reply
  • like

January 13, 2020 at 4:13am
What was your solution?
  • reply
  • like

January 17, 2020 at 7:08pm
On Record.imba I create a class variable accessor def self.table_name And in the initializer I can access it from Record:caller.table_name
Edited
  • reply
  • like
But I have to find the last caller
let caller = Record:caller
while(self instanceof caller:caller)
caller = caller:caller
Edited
  • reply
  • like