I’m trying to follow DRY way of coding. I decided to make my code cleanes.
Basically, app has 2 types of what to show to user, depending on content. So I want to set up inside show method conditional, and then two different inner methods for conditional. And, of cource, two different views for this methods.
For exapmle:
def show
If conditional
show_empty
else
show_with_content
end
def show_empty
#some code
end
def show_with_content
#some code
end
end
And I want controller to request show_emty.html.erb and show_with_content.html.erb, based on what inner method was called.
Because my view code became really dirty and overcomplicated.
But trying to do that, I faced several errors. (nil class, wrong route).
What should I set up in routes? And how explain to Rails that it should not to seek show.html.erb, but view for inner methods?