forked from jacknudt/trustieforge
Add Sync Forum
This commit is contained in:
parent
4c756aec72
commit
a2d02fb783
|
|
@ -35,7 +35,24 @@ class SyncForgesController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
|
||||
def get_forums
|
||||
all_forums = Forum.all.as_json(only: [:id, :name, :description, :creator_id]).map{|k| k["forum"]}
|
||||
respond_to do | format|
|
||||
format.json {
|
||||
render json: { all_forums: all_forums }
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def get_memos
|
||||
memos = Memo.where(forum_id: params[:forum_id])
|
||||
all_memos = memos.as_json.map{|k| k["memo"].delete_if {|k,v| v.blank?}}
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
render json: { all_memos: all_memos }
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,12 @@
|
|||
# Example: :via => :get ====> :via => :get
|
||||
|
||||
RedmineApp::Application.routes.draw do
|
||||
resources :sync_forges, only: [:index]
|
||||
resources :sync_forges, only: [:index] do
|
||||
collection do
|
||||
get :get_forums
|
||||
get :get_memos
|
||||
end
|
||||
end
|
||||
resources :sub_categories
|
||||
|
||||
resources :main_categories
|
||||
|
|
|
|||
Loading…
Reference in New Issue