Top Level Namespace

Defined Under Namespace

Modules: ApplicationHelper, HappySeed Classes: Ability, AddConfirmableToDevise, AddRefreshTokenToIdentity, AddSecretTokenToIdentity, AngularController, ConfirmationsController, CreateSimpleContents, DevisePreview, GoogleAppsClient, Identity, MakeEmailNullable, OmniauthCallbacksController, RegistrationsController, SetupController, SimpleContent, SimpleContentController, SplashController

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_passwordObject

Returns the value of attribute current_password.



2
3
4
# File 'lib/generators/happy_seed/omniauth/templates/user.rb', line 2

def current_password
  @current_password
end

#oauth_callbackObject

Returns the value of attribute oauth_callback.



1
2
3
# File 'lib/generators/happy_seed/omniauth/templates/user.rb', line 1

def oauth_callback
  @oauth_callback
end

Instance Method Details

#authenticateObject



4
5
6
7
8
9
10
# File 'lib/generators/happy_seed/base/templates/application_controller.rb', line 4

def authenticate
  unless ENV['HTTP_AUTH_USERNAME'].blank? or ENV['HTTP_AUTH_PASSWORD'].blank?
    authenticate_or_request_with_http_basic do |username, password|
      username == ENV['HTTP_AUTH_USERNAME'] && password == ENV['HTTP_AUTH_PASSWORD']
    end
  end
end

#email_required?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/generators/happy_seed/omniauth/templates/user.rb', line 17

def email_required?
  @oauth_callback != true
end

#password_required?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/generators/happy_seed/omniauth/templates/user.rb', line 12

def password_required?
  return false if email.blank? || !email_required?
  !persisted? || !password.nil? || !password_confirmation.nil?
end

#show_content(key, title = nil, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/happy_seed/simple_cms/templates/application_helper.rb', line 3

def show_content( key, title = nil, &block  )
  content = SimpleContent.where( key: key ).first

  if @debug_content
    content = nil
  end

  if content.nil?
    pos = output_buffer.length
    yield
    fragment = output_buffer.slice( pos..-1 )
    content = SimpleContent.create( key: key, body: fragment, title: title )
  else
    safe_concat content.body
  end
end