Reputation: 5
Is there a way to define the preprocessed output html name on the slim file not being the same as the slim file?
Upvotes: 0
Views: 109
Reputation: 4584
When you generate a controller with rails g controller Controller_name Controller_action
you create files that match the Controller_name
part.
Within the controller a method will be created with the name of Controller_action
e.g.
rails g controller Home index
creates the controller:
Within the index method you'll want to render your custom template by giving render the path to your template slim file.
class HomeController < ApplicationController
def index
#in here you'll want to render your template
#if no render call is given, the default home.html.slim will be rendered within the views
render 'path/to/view.html.slim'
end
end
Resource: render - Rails guides
Upvotes: 1