How to use gem podigee/device_detector project in Ruby on Rails?

Good afternoon.

Via IRB in terminal example developer works fine.
But can not figure out how to use it in the application.
In the model, controller or view?

The problem is this:
You need to load different scripts for different devices.
Please tell me how to implement.

request.headers['User-Agent'] - works only in the view. As the same register in the model?

Logic understand
def user_agent
 user_agent = request.headers['User-Agent']
 client = DeviceDetector.new(user_agent)
end


Continue using the condition
if client.device_type == 'smartphone'
...
else
...
end


What delayy wrong?
March 19th 20 at 08:48
0 answer

Find more questions by tags Ruby gemsRuby on Rails