Routing optimisation

I’m kind of a newbie, so I don’t understand all the power of routes and
implicit render that can be found in scaffolding

I have an application that have several views which are quite different
but based on the controller action.

What I would like is to be able to define routes that would go through
the same controller action but would diverge on various views

Something like


would go to :action=> display and then
the render would go to display_variant
Right now, all I can do is to render the display.html.erb

Or maybe

would do the same

I would be able to have then urls such as

and I would only design

Any thoughts ?

Thanks in advance


This is probably best done with CSS… ie max device width. However,
you could leverage the format option in rails. Normally you get things
like .html, .js, .xml as pretty standard. In your case, the “variant”
could just be a format (iPhone is a pretty typical one). Basically add
another view file, like display.js.erb or display.iphone.erb or
display.tall.erb. You may need to define the mime-types for the
non-standard ones.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs