-2

I'm starting my adventure with ruby, and got stuck in one procedure I want to do so to the point, I'm using dashing to create some dashboards.

But I need a instruction to read my URL to get query parameters from it,

I was trying to use:

url = request.original_url
print(url)

But all Im getting is

'<top (required)>': undefined local variable or method 'request' for main:Object (NameError)

Am I missing something, maybe some gem or require?

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
Wojciech Szabowicz
  • 3,646
  • 5
  • 43
  • 87

1 Answers1

1

You're trying to access the request method of controller, but you can't because you are in Model class at this point.

Note: Update your code so it will be more clear. for your reference regarding request.original_url. You may want to read up on MVC in Rails or MVC in general.

Gagan Gami
  • 10,121
  • 1
  • 29
  • 55