This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThreddedProxyController < ApplicationController | |
def topic | |
topic = Thredded::Topic.find_by(slug: params[:slug]) | |
redirect_to thredded.messageboard_topic_path( | |
messageboard_id: topic.messageboard_id, | |
id: topic.id | |
) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/thredded.rb | |
# ... | |
# snip | |
# ... | |
require 'extensions/thredded/topic' | |
Rails.application.config.to_prepare do | |
begin | |
if ActiveRecord::Base.connection.table_exists?(:thredded_topics) | |
Thredded::Topic.include(Extensions::Thredded::Topic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/extensions/thredded/topic.rb | |
module Extensions | |
module Thredded | |
module Topic | |
extend ActiveSupport::Concern | |
included do | |
after_create :create_content_page_share | |
has_many :content_page_shares, as: :content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deck | |
1 Banehound (WAR) 77 | |
9 Swamp (IKO) 268 | |
4 Act of Treason (M19) 127 | |
12 Mountain (IKO) 271 | |
4 Portent of Betrayal (THB) 149 | |
2 Barrier of Bones (GRN) 61 | |
4 Electrostatic Field (GRN) 97 | |
3 Piston-Fist Cyclops (GRN) 217 | |
1 Mayhem Devil (WAR) 204 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):032:0> result = ActiveRecord::Base.connection.execute(sql) | |
irb(main):033:0> (0...result.ntuples).each { |i| puts result.getvalue(i, 0) } | |
Sort (cost=534.90..535.03 rows=270 width=144) (actual time=1.648..1.669 rows=443 loops=1) | |
Sort Key: universes.page_type, ((universes.id)::bigint) | |
Sort Method: quicksort Memory: 87kB | |
-> Append (cost=0.08..532.72 rows=270 width=144) (actual time=0.028..1.260 rows=443 loops=1) | |
-> Result (cost=0.08..219.59 rows=120 width=144) (actual time=0.028..0.612 rows=247 loops=1) | |
-> Append (cost=0.08..219.11 rows=120 width=136) (actual time=0.027..0.580 rows=247 loops=1) | |
-> Index Scan using index_universes_on_deleted_at_and_user_id on universes (cost=0.08..82.13 rows=46 width=70) (actual time=0.027..0.139 rows=38 loops=1) | |
Index Cond: ((deleted_at IS NULL) AND (user_id = 5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy | |
FROM universes WHERE user_id = 5 AND deleted_at IS NULL AND archived_at IS NULL | |
UNION ALL | |
SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy | |
FROM characters WHERE user_id = 5 AND deleted_at IS NULL AND archived_at IS NULL | |
UNION ALL | |
SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy | |
FROM locations WHERE user_id = 5 AND deleted_at IS NULL AND archived_at IS NULL | |
UNION ALL | |
SELECT id,name,page_type,user_id,created_at,updated_at,deleted_at,archived_at,privacy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def content( | |
content_types: Rails.application.config.content_types[:all].map(&:name), | |
page_scoping: { user_id: self.id }, | |
universe_id: nil | |
) | |
return {} if content_types.empty? | |
polymorphic_content_fields = [:id, :name, :page_type, :user_id, :created_at, :updated_at, :deleted_at, :archived_at, :privacy] | |
where_conditions = page_scoping.map { |key, value| "#{key} = #{value}" }.join(' AND ') + ' AND deleted_at IS NULL AND archived_at IS NULL' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/app/vendor/bundle/ruby/2.6.0/gems/sassc-2.2.1/lib/sassc/engine.rb:42: [BUG] Segmentation fault at 0x0000000000000000 | |
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux] | |
-- Control frame information ----------------------------------------------- | |
c:0046 p:---- s:0336 e:000335 CFUNC :compile_data_context | |
c:0045 p:0298 s:0331 e:000330 METHOD /app/vendor/bundle/ruby/2.6.0/gems/sassc-2.2.1/lib/sassc/engine.rb:42 | |
c:0044 p:0006 s:0319 e:000318 BLOCK /app/vendor/bundle/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails/template.rb:40 | |
c:0043 p:0028 s:0316 e:000315 METHOD /app/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/utils.rb:138 | |
c:0042 p:0164 s:0309 e:000308 METHOD /app/vendor/bundle/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails/template.rb:39 | |
c:0041 p:0053 s:0300 e:000299 METHOD /app/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/processor_utils.rb:84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_redirect_shortcut("b", "/plan/buildings/new"); | |
add_redirect_shortcut("c", "/plan/characters/new"); | |
add_redirect_shortcut("n", "/plan/conditions/new"); | |
add_redirect_shortcut("u", "/plan/countries/new"); | |
add_redirect_shortcut("r", "/plan/creatures/new"); | |
add_redirect_shortcut("d", "/plan/deities/new"); | |
add_redirect_shortcut("w", "/plan/floras/new"); | |
add_redirect_shortcut("f", "/plan/foods/new"); | |
add_redirect_shortcut("g", "/plan/governments/new"); | |
add_redirect_shortcut("o", "/plan/groups/new"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@linked_entities = [] | |
Rails.application.config.content_types[:all].each do |content_type| | |
@linked_entities += @document.document_entities | |
.where(entity_type: content_type.name) | |
.where.not(entity_id: nil) | |
.includes(:entity, entity: [:universe, :user]) | |
.includes(entity: Rails.application.config.content_relations.fetch(content_type.name, []).map do |relation, data| | |
content_type.instance_methods.include?(data[:with]) ? data[:with] : nil | |
end.compact) | |
end |