Merge pull request #1680 from consul/chore/small_rubocop_cleanup
Chore/small rubocop cleanup
This commit is contained in:
@@ -67,6 +67,7 @@ class Admin::Poll::PollsController < Admin::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_geozones
|
||||
@geozones = Geozone.all.order(:name)
|
||||
end
|
||||
|
||||
@@ -26,6 +26,7 @@ class Legislation::AnswersController < Legislation::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def answer_params
|
||||
params.require(:legislation_answer).permit(
|
||||
:legislation_question_option_id,
|
||||
|
||||
@@ -28,6 +28,7 @@ class Officing::FinalRecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_poll
|
||||
@poll = Poll.expired.find(params[:poll_id])
|
||||
end
|
||||
|
||||
@@ -27,6 +27,7 @@ class Officing::RecountsController < Officing::BaseController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def load_poll
|
||||
@poll = Poll.find(params[:poll_id])
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
identity = Identity.first_or_create_from_oauth(auth)
|
||||
@user = current_user || identity.user || User.first_or_initialize_for_oauth(auth)
|
||||
|
||||
if save_user(@user)
|
||||
if save_user
|
||||
identity.update(user: @user)
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
|
||||
@@ -40,8 +40,8 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
end
|
||||
end
|
||||
|
||||
def save_user(user)
|
||||
def save_user
|
||||
@user.save || @user.save_requiring_finish_signup
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_activity_counts
|
||||
@activity_counts = HashWithIndifferentAccess.new(
|
||||
proposals: Proposal.where(author_id: @user.id).count,
|
||||
|
||||
@@ -12,9 +12,8 @@ class Banner < ActiveRecord::Base
|
||||
validates :post_started_at, presence: true
|
||||
validates :post_ended_at, presence: true
|
||||
|
||||
scope :with_active, -> {where("post_started_at <= ?", Time.current).
|
||||
where("post_ended_at >= ?", Time.current) }
|
||||
scope :with_active, -> { where("post_started_at <= ?", Time.current).where("post_ended_at >= ?", Time.current) }
|
||||
|
||||
scope :with_inactive,-> {where("post_started_at > ? or post_ended_at < ?", Time.current, Time.current) }
|
||||
scope :with_inactive, -> { where("post_started_at > ? or post_ended_at < ?", Time.current, Time.current) }
|
||||
|
||||
end
|
||||
|
||||
@@ -26,8 +26,8 @@ class Budget
|
||||
validates :author, presence: true
|
||||
validates :description, presence: true
|
||||
validates :heading_id, presence: true
|
||||
validates_presence_of :unfeasibility_explanation, if: :unfeasibility_explanation_required?
|
||||
validates_presence_of :price, if: :price_required?
|
||||
validates :unfeasibility_explanation, presence: { if: :unfeasibility_explanation_required? }
|
||||
validates :price, presence: { if: :price_required? }
|
||||
|
||||
validates :title, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates :description, length: { maximum: Budget::Investment.description_max_length }
|
||||
|
||||
@@ -13,7 +13,7 @@ class Comment < ActiveRecord::Base
|
||||
validates :body, presence: true
|
||||
validates :user, presence: true
|
||||
|
||||
validates_inclusion_of :commentable_type, in: ["Debate", "Proposal", "Budget::Investment", "Poll::Question", "Legislation::Question", "Legislation::Annotation"]
|
||||
validates :commentable_type, inclusion: { in: ["Debate", "Proposal", "Budget::Investment", "Poll::Question", "Legislation::Question", "Legislation::Annotation"] }
|
||||
|
||||
validate :validate_body_length
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ class Officing::Residence
|
||||
|
||||
before_validation :call_census_api
|
||||
|
||||
validates_presence_of :document_number
|
||||
validates_presence_of :document_type
|
||||
validates_presence_of :year_of_birth
|
||||
validates :document_number, presence: true
|
||||
validates :document_type, presence: true
|
||||
validates :year_of_birth, presence: true
|
||||
|
||||
validate :allowed_age
|
||||
validate :residence_in_madrid
|
||||
|
||||
@@ -15,7 +15,7 @@ class SpendingProposal < ActiveRecord::Base
|
||||
validates :title, presence: true
|
||||
validates :author, presence: true
|
||||
validates :description, presence: true
|
||||
validates_presence_of :feasible_explanation, if: :feasible_explanation_required?
|
||||
validates :feasible_explanation, presence: { if: :feasible_explanation_required? }
|
||||
|
||||
validates :title, length: { in: 4..SpendingProposal.title_max_length }
|
||||
validates :description, length: { maximum: SpendingProposal.description_max_length }
|
||||
|
||||
@@ -7,10 +7,10 @@ class Verification::Residence
|
||||
|
||||
before_validation :call_census_api
|
||||
|
||||
validates_presence_of :document_number
|
||||
validates_presence_of :document_type
|
||||
validates_presence_of :date_of_birth
|
||||
validates_presence_of :postal_code
|
||||
validates :document_number, presence: true
|
||||
validates :document_type, presence: true
|
||||
validates :date_of_birth, presence: true
|
||||
validates :postal_code, presence: true
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }
|
||||
validates :postal_code, length: { is: 5 }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ class Verification::Sms
|
||||
|
||||
attr_accessor :user, :phone, :confirmation_code
|
||||
|
||||
validates_presence_of :phone
|
||||
validates :phone, presence: true
|
||||
validates :phone, format: { with: /\A[\d \+]+\z/ }
|
||||
validate :uniqness_phone
|
||||
|
||||
|
||||
Reference in New Issue
Block a user