Skip to content

Commit 85dc600

Browse files
committed
HTML/JSON/CSV それぞれのデータの情報量を同じに統一した
1 parent d0bc1ff commit 85dc600

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/controllers/dojos_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ def index
3030
def show
3131
@dojo = Dojo.find(params[:id])
3232
@event_histories = @dojo.event_histories.order(evented_at: :DESC)
33-
.select(:id, :dojo_id, :dojo_name, :service_name, :event_id, :event_url, :participants, :evented_at)
33+
.select(:evented_at, :participants, :event_url)
3434

3535
respond_to do |format|
3636
format.html
37-
format.json { render json: @event_histories }
37+
format.json { render json: @event_histories.as_json(except: [:id]) }
3838
format.csv { send_data render_to_string, type: :csv }
3939
end
4040
end

app/views/dojos/show.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
</h1>
1515
<br>
1616
<p style="margin: 0 0px 40px 10px; line-height: 1.5em;">
17-
CoderDojo <%= @dojo[:name] %>に関する公開されている統計情報をまとめたページです。
17+
<%= link_to "CoderDojo #{@dojo[:name]}", @dojo[:url] %>に関する公開されている統計情報をまとめたページです。
1818
<br><br>
1919
<small>
2020
2121
<a href="<%= events_path %>">近日開催</a>のデータは含まず、<a href="<%= stats_path %>">過去開催</a>のデータを使っています。
2222
<br>
2323
24-
より詳細データは<code><%= link_to dojo_path(@dojo, format: :json), dojo_url(@dojo, format: :json) %></code> でご確認いただけます
24+
下記データは <code><%= link_to dojo_path(@dojo, format: :json), dojo_url(@dojo, format: :json) %></code> で JSON に変換できます
2525
<br>
2626
2727
下記データは <code><%= link_to dojo_path(@dojo, format: :csv), dojo_url(@dojo, format: :csv) %></code> で CSV に変換できます。

0 commit comments

Comments
 (0)