0

In a Padrino project, Ruby itself is smart enough to know I'm referencing my Page model instead of the paginator's Page class. But RubyMine gets lost and thinks I'm dealing with the pagination and insists in marking some errors (as new arguments vary).

What do I do in these cases?

On PHPStorm I was used to adding a PHPDoc just above the variable to tell it what type the variable is, but variable typing is not even the correct issue here... And RDoc seems too basic for this type of thing. Am I mistaken?

EDIT: RDdoc is indeed basic, but YARDoc is handy to annotate local variables. It's not useful in this case though, as the issue is indeed a name clash.

igorsantos07
  • 4,456
  • 5
  • 43
  • 62

1 Answers1

1

You can try YARDoc comments that RubyMine understands - https://www.jetbrains.com/help/ruby/2017.1/using-annotations.html#d464455e37

Besides that you can use full path to the class/constant you're using

Page.do_something # "relative" call
::Page.do_something # "top" call
Module::Path::To::Page.do_something # full path call
insider
  • 352
  • 2
  • 5
  • The `::Page` trick still takes me to `Padrino::Cache::Helpers::Page`... maybe because that module is included in the controllers? – igorsantos07 May 14 '17 at 23:23
  • and thanks for the YARDoc tip. That will certainly be useful somewhere else, but here it's indeed of no use as the issue is with the name conflict itself.. – igorsantos07 May 14 '17 at 23:23
  • There is one more way if you dont want to write full path module name - you can define "local" constant as shortcut - `MPage = Path::To::Model::Page`. This is ofcourse based on presumption that the Page model is in another module (namespace). Also Rubymine handles available class names/constants based on gemfile in project root. – insider May 15 '17 at 08:14