add journal_list. now, those pair, (journal_title, journal_levels), is uniq

This commit is contained in:
Rueshyna committed 2012-11-30 23:50:46 +08:00
1 parent ccacef6d9e
commit cc6339d59b
5 files changed
+52 -27

No files matched your search

@@ -2,14 +2,23 @@ class Desktop::JournalListsController < ApplicationController
# GET /desktop/journal_lists
# GET /desktop/journal_lists.json
def index
@desktop_journal_lists = Desktop::JournalList.all
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
all_journal_lists = all_journal_lists.map do |j|
[ j.journal_title,
j.journal_level_type_ids.map do |type|
level_types.find(type).title
end.join(",")
].join(" -- ")
end
@journal_lists = all_journal_lists.uniq
respond_to do |format|
format.html # index.html.erb
format.json { render json: @desktop_journal_lists }
format.html { render :layout => false}
end
end
=begin
# GET /desktop/journal_lists/1
# GET /desktop/journal_lists/1.json
def show
@@ -80,4 +89,5 @@ class Desktop::JournalListsController < ApplicationController
format.json { head :ok }
end
end
=end
end