Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
確認画面への都道府県表示対応
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiteruIwasaki committed Aug 25, 2015
1 parent 71566f1 commit b7c270a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/inquiry.rb
@@ -1,4 +1,8 @@
class Inquiry < ActiveRecord::Base

include JpPrefecture
jp_prefecture :prefecture, method_name: :pref

validates :name, presence: true,length: { maximum: 100 }
validates :zip, length: { is: 7 }
validates :prefecture, numericality: {
Expand Down
4 changes: 2 additions & 2 deletions app/views/inquiries/_form.html.erb
Expand Up @@ -53,7 +53,7 @@
<% if @inquiry.confirm.blank? %>
<%= f.collection_select :prefecture, JpPrefecture::Prefecture.all, :code, :name, {prompt: t("views.inquiries.placeholder.prefecture")}, {class: "form-control"} %>
<% else %>
<p class="form-control-static"><%= @inquiry[:prefecture] %></p>
<p class="form-control-static"><%= JpPrefecture::Prefecture.find(@inquiry[:prefecture]).name %></p>
<%= f.hidden_field :prefecture %>
<% end %>
</div>
Expand Down Expand Up @@ -101,7 +101,7 @@
<% if @inquiry.confirm.blank? %>
<%= f.text_area :content, :class => 'form-control', :size => "20x10",:placeholder => t("views.inquiries.placeholder.content") %>
<% else %>
<p class="form-control-static"><%= @inquiry[:content] %></p>
<p class="form-control-static"><%= simple_format(h(@inquiry[:content])) %></p>
<%= f.hidden_field :content %>
<% end %>
</div>
Expand Down

0 comments on commit b7c270a

Please sign in to comment.