View
👍 pass a variable into partial
The file app/views/shared/_question.html.erb
will be called, and it receives a variable model
.
<%= render partial: 'shared/question', locals: { model: @attender } %>
👍 pass all variables into parcial or use it.
<%= render partial: 'shared/question', locals: local_assigns } %>
🦄 Another technique
<% unless local_assigns[:hide] %>
hello
<% end %>
Helper
Setting to use only the helper with same name controller
config/application.rb
config.action_controller.include_all_helpers = false
Use helper method
module MyHelper
def some
# do something
end
end
class SomeController
include MyHelper
end
Top comments (0)