Permalink
Browse files

- remove unnecessary validations

  • Loading branch information...
1 parent 99f18b3 commit ecc1d1be3f41f36707a266b8184e77444c4d6a70 @abaranov abaranov committed Jul 12, 2012
Showing with 7 additions and 25 deletions.
  1. +5 −5 app/controllers/courses_controller.rb
  2. +2 −2 app/controllers/lessons_controller.rb
  3. +0 −18 app/models/user.rb
@@ -1,7 +1,7 @@
class CoursesController < ApplicationController
before_filter :authenticate_user!, except: %w(show index)
- #before_filter :preload_interest_tree, only: %w(edit new)
+ before_filter :preload_interest_tree, only: %w(edit new create update)
def show
@course = Course.find(params[:id])
@@ -29,8 +29,8 @@ def create
end
end
- #private
- # def preload_interest_tree
- # @interests = Interest.includes(:sub_interests)
- # end
+ private
+ def preload_interest_tree
+ @interests = Interest.includes(:sub_interests)
+ end
end
@@ -1,15 +1,15 @@
class LessonsController < ApplicationController
before_filter :authenticate_user!, except: %w(show index)
- before_filter :preload_interest_tree, only: %w(edit new_lesson index)
+ before_filter :preload_interest_tree, only: %w(edit new_lesson index create update)
def show
@lesson = Lesson.find(params[:id])
end
def edit
@lesson = Lesson.find(params[:id])
- @interests = Interest.includes(:sub_interests)
+ #@interests = Interest.includes(:sub_interests)
end
def update
View
@@ -30,16 +30,6 @@ class User < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :sex
- validates_presence_of :email, if: :email_required?
- validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
- validates_format_of :email, with: email_regexp, allow_blank: true, if: :email_changed?
-
- validates_presence_of :password, if: :password_required?
- validates_confirmation_of :password, if: :password_required?
- validates_length_of :password, within: password_length, allow_blank: true
-
- validates_presence_of :password_confirmation, if: :password_required?
-
VKONTAKTE_SEX_ASSOCIATIONS = {
0 => 'unknown',
1 => 'female',
@@ -97,12 +87,4 @@ def self.oauth_find_or_create(provider, auth)
def full_name
[first_name, last_name].join " "
end
-
- def password_required?
- !persisted? || !password.nil? || !password_confirmation.nil?
- end
-
- def email_required?
- true
- end
end

0 comments on commit ecc1d1b

Please sign in to comment.