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

adding object type model and associate with learning object

parent 0691e281
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,8 @@ GEM
addressable (2.3.8)
arel (6.0.3)
ast (2.2.0)
autoprefixer-rails (6.3.1)
autoprefixer-rails (6.3.3.1)
execjs
json
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
......@@ -62,7 +61,7 @@ GEM
bullet (5.0.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0)
byebug (8.2.1)
byebug (8.2.2)
chart-js-rails (0.0.9)
railties (> 3.1)
chronic (0.10.2)
......@@ -70,9 +69,9 @@ GEM
activesupport (>= 3.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
codeclimate-engine-rb (0.1.0)
codeclimate-engine-rb (0.3.1)
virtus (~> 1.0)
coderay (1.1.0)
coderay (1.1.1)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (4.1.1)
......@@ -86,7 +85,7 @@ GEM
concurrent-ruby (1.0.0)
connection_pool (2.2.0)
curb (0.8.8)
dalli (2.7.5)
dalli (2.7.6)
debug_inspector (0.0.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
......@@ -100,7 +99,7 @@ GEM
devise_token_auth (0.1.37)
devise (> 3.5.2, < 4.1)
rails (< 6)
dspace_rest_client (2.2.2)
dspace_rest_client (2.2.4)
activesupport (~> 4.2, >= 4.2.0)
faraday (~> 0.9.2)
json (~> 1.8, >= 1.8.3)
......@@ -142,7 +141,7 @@ GEM
multi_xml (>= 0.5.2)
i18n (0.7.0)
ice_nine (0.11.2)
jbuilder (2.4.0)
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.0)
......@@ -167,7 +166,7 @@ GEM
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.99)
mime-types (2.99.1)
mimemagic (0.3.0)
mina (0.3.8)
open4 (~> 1.3.4)
......@@ -182,13 +181,13 @@ GEM
mini_portile2 (~> 2.0.0.rc2)
open4 (1.3.4)
orm_adapter (0.5.0)
paperclip (4.3.3)
paperclip (4.3.5)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
parser (2.3.0.2)
parser (2.3.0.6)
ast (~> 2.2)
pg (0.18.4)
private_attr (1.1.0)
......@@ -231,11 +230,11 @@ GEM
rake (10.5.0)
rake-compiler (0.9.5)
rake
rdoc (4.2.1)
rdoc (4.2.2)
json (~> 1.4)
redis (3.2.2)
reek (3.9.1)
codeclimate-engine-rb (~> 0.1.0)
reek (3.10.1)
codeclimate-engine-rb (~> 0.3.1)
parser (~> 2.3)
private_attr (~> 1.1)
rainbow (~> 2.0)
......@@ -249,15 +248,15 @@ GEM
rmagick (2.15.4)
rsolr (1.0.13)
builder (>= 2.1.2)
ruby_parser (3.7.3)
ruby_parser (3.8.1)
sexp_processor (~> 4.1)
rubycritic (2.7.0)
rubycritic (2.7.1)
colorize
flay (= 2.6.1)
flog (= 4.3.2)
launchy (= 2.4.3)
parser (~> 2.3)
reek (= 3.9.1)
reek (= 3.10.1)
virtus (~> 1.0)
sass (3.4.21)
sass-rails (5.0.4)
......@@ -269,13 +268,13 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
searchkick (1.1.2)
searchkick (1.2.1)
activemodel
elasticsearch (>= 1)
hashie
select2-rails (4.0.1)
thor (~> 0.14)
sexp_processor (4.6.1)
sexp_processor (4.7.0)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
......@@ -295,7 +294,7 @@ GEM
slim (3.0.6)
temple (~> 0.7.3)
tilt (>= 1.3.3, < 2.1)
spring (1.6.2)
spring (1.6.3)
sprockets (3.5.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
......
......@@ -12,7 +12,7 @@ class LearningObjectsController < ApplicationController
# GET /learning_objects/1
# GET /learning_objects/1.json
def show
@liked = !@learning_object.likes.where(user: current_user).blank? if user_signed_in?
@liked = !@learning_object.liked?(current_user) if user_signed_in?
@reviews = Review.includes(:user).where(reviewable: @learning_object)
end
......
......@@ -13,12 +13,11 @@ class LearningObject < ActiveRecord::Base
belongs_to :publisher, polymorphic: true
belongs_to :language
belongs_to :object_type
validates_presence_of :name, :id_dspace
validates_uniqueness_of :id_dspace
scope :object_types, -> { group(:object_type).count.reject { |type, frequency| type.blank? }.map { |type, frequency| type } }
searchkick language: 'brazilian', match: :word_start, searchable: [:name, :description, :author, :object_type]
def search_data
......
class ObjectType < ActiveRecord::Base
has_many :learning_objects
validates :name, presence: true
end
\ No newline at end of file
class CreateObjectTypes < ActiveRecord::Migration
def change
create_table :object_types do |t|
t.string :name
end
end
end
class ChangeColumnObjectTypeOfLearningObjects < ActiveRecord::Migration
def change
remove_column :learning_objects, :object_type, :string
add_reference :learning_objects, :object_type
end
end
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