Commit d292c58
Changed files (3)
app
models
app/models/user.rb
@@ -5,11 +5,10 @@ class User < ActiveRecord::Base
validates :username, presence: true, format: { with: USERNAME_REGEX }, uniqueness: true
validates :email, presence: true, email: true, uniqueness: true
validates_acceptance_of :terms_and_conditions
-
+
def self.authenticate(username,password)
if user = User.where("email = :email OR username = :username", username: username, email: username).first
user.authenticate(password)
end
end
-
end
config/application.rb
@@ -14,7 +14,7 @@ require "sprockets/railtie"
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
-module App
+module StrongLifters
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
@@ -27,7 +27,7 @@ module App
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
-
+
# Override field_with_errors div insertion that breaks field formatting
config.action_view.field_error_proc = Proc.new { |html_tag, _instance|
html_tag
config/database.yml.example
@@ -23,13 +23,13 @@ default: &default
development:
<<: *default
- database: app_development
+ database: stronglifters_development
# The specified database role being used to connect to postgres.
# To create additional roles in postgres see `$ createuser --help`.
# When left blank, postgres will use the default role. This is
# the same name as the operating system user that initialized the database.
- #username: app
+ #username: stronglifters
# The password associated with the postgres role (username).
#password:
@@ -57,7 +57,7 @@ development:
# Do not set this db to the same as development or production.
test:
<<: *default
- database: app_test
+ database: stronglifters_test
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
@@ -80,6 +80,6 @@ test:
#
production:
<<: *default
- database: app_production
- username: app
+ database: stronglifters_production
+ username: stronglifters
password: <%= ENV['APP_DATABASE_PASSWORD'] %>