Permalink
Browse files

fixed favorites issue

  • Loading branch information...
1 parent 2234065 commit e08f34545875a2af0e1b0c137417ffdec73b20c1 @starmandell committed Jun 7, 2012
Showing with 13 additions and 5 deletions.
  1. +10 −2 app/controllers/articles_controller.rb
  2. +2 −2 app/controllers/lessons_controller.rb
  3. +1 −1 db/schema.rb
@@ -60,7 +60,7 @@ def update
:author => @article.user.name,
:author_id => @article.user.id,
:all => '1',
- :docid => @article.id,
+ :docid => 'article'+@article.id.to_s,
:tags => @article.article_tags.map(&:name).join(', '),
:lesson_autocomplete => '',
:article_autocomplete => @article.title + ' ' + @article.article_tags.map(&:name).join(', '),
@@ -146,10 +146,13 @@ def search
@direction = 'article'
end
- def favorites
+ def favorites
sort = check_sort(params[:score].to_i)
article_ids = FavArticleRelationship.where(:user_id => current_user).map(&:article_id)
+
+
+
q_params = ''
article_ids.each do |i|
q_params << 'article' + i.to_s + ' OR '
@@ -159,9 +162,14 @@ def favorites
@result_items = []
else
q = 'docid:('+q_params[0..-5]+')'
+ puts 'baby2'
+ puts q
@result_items = create_result_items(q, sort)
end
+ puts 'nipple'
+ puts @result_items
+
@total_count = article_ids.count
@direction = 'article'
@@ -24,7 +24,7 @@ def index
Preschool, kindergarten, elementary, middle school, high school',
:keywords => 'Educational Resources, Teaching Resources, Teaching Materials'
#to delete
- #$index.document('lesson199').delete
+ #$index.document('lesson1').delete
@direction = 'lesson'
@total_count = Lesson.count
@@ -76,7 +76,7 @@ def update
:author => @lesson.user.name,
:author_id => @lesson.user.id,
:all => '1',
- :docid => @lesson.id,
+ :docid => 'lesson'+@lesson.id.to_s,
:tags => @lesson.tags.map(&:name).join(', '),
:lesson_autocomplete => @lesson.title + ' ' + @lesson.tags.map(&:name).join(', '),
:article_autocomplete => '',
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120607013551) do
+ActiveRecord::Schema.define(:version => 20120607015838) do
create_table "admins", :force => true do |t|
t.string "email", :default => "", :null => false

0 comments on commit e08f345

Please sign in to comment.