two versions of show.html.erb

9 views
Skip to first unread message

Gerardo Abregu

unread,
Oct 26, 2015, 9:57:27 PM10/26/15
to rubyonra...@googlegroups.com
Can i have two versions of show.html.erb for the same model.Is it
possible.

--
Posted via http://www.ruby-forum.com/.

Norm Scherer

unread,
Oct 27, 2015, 1:44:55 AM10/27/15
to rubyonra...@googlegroups.com
Where would you plan on putting two files with the same name? You can
embed erb (if then else) in the file to make it do different things in a
different situation.

Norm

Colin Law

unread,
Oct 27, 2015, 4:33:04 AM10/27/15
to Ruby on Rails: Talk
On 27 October 2015 at 01:56, Gerardo Abregu <li...@ruby-forum.com> wrote:
> Can i have two versions of show.html.erb for the same model.Is it
> possible.

First note that views do not relate directly to models, they relate to
controllers. A controller does not necessarily map directly to a
model. So more correctly you should have asked whether you can have
two show views for the same controller.

The strict answer is no, but in order to suggest the best alternative
let us know
1. Under what circumstances do you want to show the different view?
2. How different are the views?

By the way, I notice that the last time you asked a question here
several people made suggestions but you did not reply. It is not good
manners to ask for help and then not offer thanks when it is provided.

Colin
Reply all
Reply to author
Forward
0 new messages