Module: CanonicalRails

Defined in:
lib/canonical-rails.rb,
lib/canonical-rails/engine.rb,
lib/canonical-rails/version.rb,
lib/canonical-rails/deprecation.rb,
app/helpers/canonical_rails/tag_helper.rb,
lib/generators/canonical_rails/install/install_generator.rb

Defined Under Namespace

Modules: TagHelper Classes: Engine, InstallGenerator

Constant Summary collapse

VERSION =
"0.2.16"
Deprecation =
ActiveSupport::Deprecation.new('1.0', 'CanonicalRails')
@@host =
nil
@@port =
nil
@@protocol =
nil
@@collection_actions =
[:index]
@@whitelisted_parameters =
[]
@@allowed_parameters =
[]
@@opengraph_url =
false

Class Method Summary collapse

Class Method Details

.setup {|_self| ... } ⇒ Object

Default way to setup CanonicalRails. Run ‘rails g canonical_rails:install` to create a fresh initializer with all configuration values.

the configsetup concept politely observed at and borrowed from Devise: github.com/plataformatec/devise/blob/master/lib/devise.rb

Yields:

  • (_self)

Yield Parameters:



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

def self.setup
  yield self
end

.sym_allowed_parametersObject



41
42
43
44
45
46
47
48
# File 'lib/canonical-rails.rb', line 41

def self.sym_allowed_parameters
  @@sym_allowed_parameters ||= if self.whitelisted_parameters.empty?
    self.allowed_parameters.map(&:to_sym)
  else
    CanonicalRails::Deprecation.warn('config.whitelisted_parameters is deprecated, please use config.allowed_parameters instead.')
    self.whitelisted_parameters.map(&:to_sym)
  end
end

.sym_collection_actionsObject



37
38
39
# File 'lib/canonical-rails.rb', line 37

def self.sym_collection_actions
  @@sym_collection_actions ||= self.collection_actions.map(&:to_sym)
end