Module: RailsAjax

Defined in:
lib/rails-ajax.rb,
lib/rails-ajax/railtie.rb,
lib/rails-ajax/rails-ajax.rb,
lib/rails-ajax/url_helper.rb,
lib/rails-ajax/controller.rb,
lib/rails-ajax/configuration.rb,
lib/rails-ajax/form_tag_helper.rb

Overview

Main namespace encapsulating all rails-ajax API

Defined Under Namespace

Modules: Controller, FormTagHelper, UrlHelper Classes: Configuration, Railtie

Class Method Summary collapse

Class Method Details

.configObject

Give access to the configuration

Return
  • RailsAjax::Configuration: The RailsAjax configuration


12
13
14
# File 'lib/rails-ajax/rails-ajax.rb', line 12

def self.config
  @configuration
end

.configure(&config_block) ⇒ Object

Configure RailsAjax

Parameters
  • config_block (CodeBlock): Block called that will contain all configuration directives


20
21
22
# File 'lib/rails-ajax/rails-ajax.rb', line 20

def self.configure(&config_block)
  @configuration.instance_eval(&config_block)
end

.rails_ajaxifiable?(options) ⇒ Boolean

Find if we use rails-ajax for a given set of options applicable to a link

Parameters
  • options (map<Symbol,Object>): The options provided to a link (used in link_to or form_tag)

Result
  • Boolean: Would this link be handled by rails-ajax?


30
31
32
33
34
35
# File 'lib/rails-ajax/rails-ajax.rb', line 30

def self.rails_ajaxifiable?(options)
  options[:use_rails_ajax] != false && # User has not removed rails-ajax voluntarily
  options[:target].nil? && # Open in the same window and
  options[:onclick].nil? && # Do not override the onclick event
  !options.key?(:remote) # User has not specified Ajax call itself
end

.rootObject

Give the root directory of the RailsAjax installation

Return
  • String: RailsAjax root directory


10
11
12
# File 'lib/rails-ajax.rb', line 10

def self.root
  File.expand_path("#{File.dirname(__FILE__)}/..")
end