Skip to content
Snippets Groups Projects
Commit 197cdeeb authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

setting default scope for learning objects

now, learning objects includes objects types and will be ordered by score
parent 953624de
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ class LearningObjectsController < ApplicationController
@learning_object = LearningObject.new
@school_levels = ['Educação Infantil', 'Ensino Fundamental', 'Ensino Médio']
@topics = Topic.defaults
@types = LearningObject.object_types
@types = ObjectType.all
@languages = Language.all
end
......@@ -74,7 +74,7 @@ class LearningObjectsController < ApplicationController
def like
if @learning_object.liked? current_user
@learning_object.dislike current_user
else
elseg
@learning_object.like current_user
end
......
......@@ -3,7 +3,7 @@ class WelcomeController < ApplicationController
def index
@carousel = Carousel.all || []
@highlights = LearningObject.order(:score).limit(6)
@highlights = LearningObject.limit(6)
end
def faq
......
......@@ -20,6 +20,8 @@ class LearningObject < ActiveRecord::Base
searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type]
default_scope { includes(:object_type).order(:score) }
def search_data
{
name: name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment