Skip to content

Instantly share code, notes, and snippets.

@raketbizdev
Created March 16, 2018 19:01
Show Gist options
  • Save raketbizdev/e6121017ddf4b8a1feb92e1518a0bffd to your computer and use it in GitHub Desktop.
Save raketbizdev/e6121017ddf4b8a1feb92e1518a0bffd to your computer and use it in GitHub Desktop.
<%= form_with(model: document, local: true) do |form| %>
<% if document.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(document.errors.count, "error") %> prohibited this document from being saved:</h2>
<ul>
<% document.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= form.label :title %>
<%= form.text_field :title, id: :document_title %>
</div>
<div class="field">
<%= form.label :content %>
<%= form.text_area :content, id: :document_content %>
</div>
<div class="actions">
<%= form.submit %>
</div>
<% end %>
# I try the helper Medthod but its not working
module ApplicationHelper
def my_name
your_name = "Ruel Nopal"
end
end
class Document < ApplicationRecord
# Try in Model
def my_name
your_name = "Ruel Nopal"
end
end
@raketbizdev
Copy link
Author

screen shot 2018-03-17 at 3 11 43 am

@raketbizdev
Copy link
Author

screen shot 2018-03-17 at 3 12 38 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment