Guest User

Untitled

a guest
Feb 20th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. Index: app/controllers/assets_controller.rb
  2. ===================================================================
  3. --- app/controllers/assets_controller.rb (revision 1780)
  4. +++ app/controllers/assets_controller.rb (working copy)
  5. @@ -4,8 +4,8 @@
  6. def show
  7. content_type = Attachment.content_path.index(params[:dir])
  8. @asset = content_type ?
  9. - Resource.find_by_content_type_and_filename(content_type, params[:path].first) :
  10. - Resource.find_image(params[:path].first)
  11. + site.resources.find_by_content_type_and_filename(content_type, params[:path].first) :
  12. + site.resources.find_image(params[:path].first)
  13. self.cached_references << @asset
  14.  
  15. if @asset.nil?
  16. Index: lib/convert/typo.rb
  17. ===================================================================
  18. --- lib/convert/typo.rb (revision 1780)
  19. +++ lib/convert/typo.rb (working copy)
  20. @@ -32,8 +32,7 @@
  21. users
  22. end
  23.  
  24. - def find_or_create_sections(typo_article)
  25. - site = ::Site.find(1)
  26. + def find_or_create_sections(site, typo_article)
  27. home_section = site.sections.home
  28. section_ids = typo_article.categories.inject([home_section.id]) do |a, c|
  29. a << (site.sections.find_by_path(::Section.permalink_for(c.name)) || site.sections.create(:name => c.name)).id
  30. @@ -47,7 +46,7 @@
  31. default_user :
  32. ::User.find_by_login(Typo::User.find(typo_article.user_id).login)
  33.  
  34. - section_ids = find_or_create_sections(typo_article)
  35. + section_ids = find_or_create_sections(site, typo_article)
  36.  
  37. excerpt, body = !typo_article.extended.blank? ?
  38. [typo_article.body, typo_article.extended] :
Add Comment
Please, Sign In to add comment