What does `embeddable_hosts` do?


(Flap Jack) #1

Hi!

What does embeddable_hosts do? Got this in my site_settings.yml:

embedding:
  embeddable_hosts:
    default: 'example.com'
    type: host_list

but getting:

Processing by TopicsController#similar_to as JSON
  Parameters: {"title"=>"Uploading example logo", "raw"=>"<img src=\"/uploads/default/original/1X/f552a85c9bea6d906f1156677afc0c48d73f35ee.png\" width=\"85\" height=\"62\"> ", "_"=>"1435954310637"}
Completed 200 OK in 10ms (Views: 1.2ms | ActiveRecord: 1.6ms)
Completed 200 OK in 779ms (Views: 1.3ms | ActiveRecord: 101.0ms)
Started GET "/t/12.json?track_visit=true&forceLoad=true&_=1435954310638" at 2015-07-03 22:12:25 +0200
Processing by TopicsController#show as JSON
  Parameters: {"track_visit"=>"true", "forceLoad"=>"true", "_"=>"1435954310638", "id"=>"12"}
Completed 500 Internal Server Error in 262ms (ActiveRecord: 57.3ms)

NoMethodError (undefined method `embeddable_host' for #<Class:0x0000080c857de8>):
  app/models/topic.rb:845:in `expandable_first_post?'
  app/serializers/topic_view_serializer.rb:205:in `include_expandable_first_post?'
  app/controllers/application_controller.rb:248:in `render_json_dump'
  app/controllers/topics_controller.rb:489:in `block (2 levels) in perform_show_response'
  app/controllers/topics_controller.rb:482:in `perform_show_response'
  app/controllers/topics_controller.rb:82:in `show'
  lib/middleware/anonymous_cache.rb:123:in `call'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:26:in `call'
  lib/middleware/request_tracker.rb:70:in `call'

Works fine if I comment the insides of expandable_first_post? in app/models/topic.rb though.


(Jeff Atwood) #2

See Embedding Discourse in Static Sites - Evil Trout's Blog


(Flap Jack) #3

That is absolutely awesome. Thank you!