diff --git a/Gemfile b/Gemfile index 33b638b6..22598fd7 100644 --- a/Gemfile +++ b/Gemfile @@ -31,8 +31,8 @@ gem 'rails-jquery-autocomplete' gem 'meta-tags' # Smarts -# gem 'serendipitous', :path => "~/Code/indent/serendipitous-gem" -gem 'serendipitous', git: 'git://github.com/indentlabs/serendipitous-gem.git' +# gem 'serendipitous', :path => "~/git/serendipitous-gem" +gem 'serendipitous', git: 'https://github.com/indentlabs/serendipitous-gem.git' # Editor gem 'medium-editor-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 4e5a4956..ca482812 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: git://github.com/indentlabs/serendipitous-gem.git - revision: 3e1808e873e00e1d59a918a5ac4306b22de3c5df + remote: https://github.com/indentlabs/serendipitous-gem.git + revision: 393c9b664e0cbfacfc06d44dfd43898413b539a5 specs: serendipitous (0.0.2) diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 0e201fb7..166b107e 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -12,13 +12,8 @@ class ContentController < ApplicationController @content = @content.where(universe: @universe_scope) if @universe_scope.present? && @content.build.respond_to?(:universe) @content ||= [] - - begin - @questioned_content = @content.sample - questionable_params = content_param_list.reject { |x| x.is_a?(Hash) || x.to_s.end_with?('_id') } - @question = QuestionService.question(Content.new @questioned_content.slice(*questionable_params)) - rescue - end + @questioned_content = @content.sample + @question = @questioned_content.question unless @questioned_content.nil? respond_to do |format| format.html # index.html.erb @@ -29,15 +24,7 @@ class ContentController < ApplicationController def show # TODO: Secure this with content class whitelist lel @content = content_type_from_controller(self.class).find(params[:id]) - - if current_user and current_user == @content.user - # question = QuestionService.question(Content.new @content.slice(*content_param_list.flat_map { |v| v.is_a?(Symbol) ? v : v.keys.map { |k| k.to_s.chomp('_attributes').to_sym } })) - begin - questionable_params = content_param_list.reject { |x| x.is_a?(Hash) || x.to_s.end_with?('_id') } - @question = QuestionService.question(Content.new @content.slice(*questionable_params)) - rescue - end - end + @question = @content.question if current_user.present? and current_user == @content.user respond_to do |format| format.html # show.html.erb diff --git a/app/models/character.rb b/app/models/character.rb index 0f93c531..652d0e60 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -16,6 +16,7 @@ class Character < ActiveRecord::Base include HasPrivacy include HasContentGroupers + include Serendipitous::Concern # Characters relates :fathers, with: :fatherships diff --git a/app/models/item.rb b/app/models/item.rb index 4661773a..9e467afb 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -14,6 +14,7 @@ class Item < ActiveRecord::Base include HasPrivacy include HasContentGroupers + include Serendipitous::Concern # Characters relates :original_owners, with: :original_ownerships diff --git a/app/models/location.rb b/app/models/location.rb index 82914f53..2773b41b 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -17,6 +17,7 @@ class Location < ActiveRecord::Base include HasPrivacy include HasContentGroupers + include Serendipitous::Concern # Characters relates :leaders, with: :location_leaderships diff --git a/app/models/universe.rb b/app/models/universe.rb index 8c7d800e..f4aff108 100644 --- a/app/models/universe.rb +++ b/app/models/universe.rb @@ -7,6 +7,7 @@ # contains all canonically-related content created by Users class Universe < ActiveRecord::Base include HasPrivacy + include Serendipitous::Concern validates :name, presence: true diff --git a/app/views/cards/serendipitous/_content_question.html.erb b/app/views/cards/serendipitous/_content_question.html.erb index 37b2fccd..d06de7d5 100644 --- a/app/views/cards/serendipitous/_content_question.html.erb +++ b/app/views/cards/serendipitous/_content_question.html.erb @@ -15,7 +15,7 @@ %>