Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
AuthenticatedSystem, ExceptionNotifiable, RoleRequirementSystem, SslRequirement
Defined in:
app/controllers/application_controller.rb

Overview

Filters added to this controller apply to all controllers in the application. Likewise, all the methods added will be available for all controllers.

Direct Known Subclasses

Admin::AdminController, Admin::ContentCopiesController, AgendaItemsController, AlphabeticIndicesController, AttachmentsController, CalendarsController, CarrouselsController, CombinedCalendarsController, CommentsController, ContactBoxesController, ContactFormsController, EventsController, FeedsController, ForumPostsController, ForumThreadsController, ForumTopicsController, ForumsController, HtmlPagesController, ImagesController, LinksController, MonitController, NewsArchivesController, NewsItemsController, NewsViewersController, NewsletterArchivesController, NewsletterEditionsController, PagesController, PollQuestionsController, PollsController, SearchController, SearchPagesController, SectionsController, SessionsController, SharesController, SitemapsController, SocialMediaLinksBoxesController, TopHitsPagesController, UsersController, WeblogArchivesController, WeblogPostsController, WeblogsController

Constant Summary

SEARCH_SCOPE_SEPARATOR =
[ '_______________________________', 'separator' ]

Instance Method Summary (collapse)

Methods included from RoleRequirementSystem

included

Instance Method Details

- (Object) all_changes

Called when we need to include hidden nodes on local requests Before filter sets current user to admin on local requests to this method



77
78
79
# File 'app/controllers/application_controller.rb', line 77

def all_changes
  changes
end

- (Object) changes



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'app/controllers/application_controller.rb', line 81

def changes
  if !@node.nil? && @node.content_class != Feed && params[:format] == 'atom'
    if @node.has_changed_feed
      @nodes = @node.last_changes(:self)
    elsif @node.content_class <= Section
      options       = { :limit => 50 }
      options[:for] = current_user if logged_in?
      @nodes = @node.last_changes(:all, options)[0..24]
    else
      raise ActionController::UnknownAction
    end
    respond_to do |format|
      format.atom { render :template => '/shared/changes', :layout => false }
    end
  else
    raise ActionController::UnknownAction
  end
end

- (Object) synonyms

GET /synonyms.txt



101
102
103
104
105
106
107
108
109
# File 'app/controllers/application_controller.rb', line 101

def synonyms
  synonyms = {}
  Synonym.all.each do |syn|
    synonyms[syn.original] ||= [syn.original]
    synonyms[syn.original] << syn.name
  end
  synonyms = synonyms.collect { |key, set| set.uniq.join(", ") }
  send_data synonyms.join("\n"), :filename => 'synonyms.txt', :type => 'text/plain', :disposition => 'attachment'
end