-
Notifications
You must be signed in to change notification settings - Fork 167
Update support to mongoid ~> 7 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
require "bundler/gem_tasks" | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
class_eval "def #{value}?() self.#{field_name} == :#{value} end" | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end" | ||
class_eval "def #{value}?() self.#{field_name} == :#{value} end", __FILE__, __LINE__ | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end", __FILE__, __LINE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [107/80]
end | ||
|
||
def define_string_accessor(field_name, value) | ||
class_eval "def #{value}?() self.#{field_name} == :#{value} end" | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end" | ||
class_eval "def #{value}?() self.#{field_name} == :#{value} end", __FILE__, __LINE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [92/80]
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end" | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end" | ||
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end", __FILE__, __LINE__ | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [119/80]
end | ||
|
||
def define_array_accessor(field_name, value) | ||
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end" | ||
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end" | ||
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end", __FILE__, __LINE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [99/80]
|
||
require 'mongoid/enum/version' | ||
require 'mongoid/enum/validators/multiple_validator' | ||
require 'mongoid/enum/configuration' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
# frozen_string_literal: true | ||
|
||
require 'mongoid/enum/version' | ||
require 'mongoid/enum/validators/multiple_validator' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
require "mongoid/enum/configuration" | ||
# frozen_string_literal: true | ||
|
||
require 'mongoid/enum/version' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
module Mongoid | ||
module Enum | ||
class Configuration | ||
attr_accessor :field_name_prefix | ||
|
||
def initialize | ||
self.field_name_prefix = "_" | ||
self.field_name_prefix = '_' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
end | ||
end | ||
|
||
def add_error_message(record, attribute) | ||
record.errors[attribute] << (options[:message] || "is not in #{options[:in].join ", "}") | ||
record.errors[attribute] << (options[:message] || "is not in #{options[:in].join ', '}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [98/80]
No description provided.