Module: RailsAjax

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

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



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

def self.config
  return @configuration
end

.configure(&config_block) ⇒ Object

Configure RailsAjax

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



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

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?

Returns:

  • (Boolean)


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

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

.rootObject

Give the root directory of the RailsAjax installation

Return
  • String: RailsAjax root directory



7
8
9
# File 'lib/rails-ajax.rb', line 7

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