1) Let me start with mobvious :-
Mobvious detects whether your app / website is being accessed by a phone, or by a tablet, or by a personal computer.
Basic installation :-
There is a good plugin especially made for rails mobvious-rails.
So after adding mobvious we can use method request.env[‘mobvious.device_type’] to get the current type of device i.e., desktop, tablet or mobile.
2) Now we have to set the variant in application_controller.rb
This will set request.variant value to its respective device.
3) Now the easy part we have tell controller which partial to load according to request.variant value. That can be done in two ways :-
4) Just create the views according to the format name. lets say we want to create index view for tablet we can create that view as index.html+tablet.erb which will be automatically detected by rails controller by default.
I have attached a few screenshots below :-
This is my first blog post hope you guys like it. Looking forward to your feedback.