Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/controllers/dojos_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class DojosController < ApplicationController
def index
@dojo_data = []
Dojo.active.each do |dojo|
@dojo_data << {
name: dojo.name,
url: dojo.url,
prefecture: dojo.prefecture.region,
linked_text: "<a href='#{dojo.url}'>'#{dojo.name}</a>(#{dojo.prefecture.region})",
}
end

respond_to do |format|
format.json { render json: @dojo_data }

# No corresponding View for now.
# Only for API: GET /dojos.json
format.html { redirect_to root_url(anchor: 'dojos') }
end
end
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
get "/kata" => "docs#kata"
#get "/debug/kata" => "docs#kata"


resources :dojos, only: %i(index) # Only API: GET /dojos.json
resources :docs, only: %i(index show)
resources :podcasts, only: %i(index show)
resources :spaces, only: %i(index)
Expand Down