forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix minor spec failures with Mongoid
- Loading branch information
Showing
24 changed files
with
232 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Fan < ActiveRecord::Base | ||
validates_presence_of(:name) | ||
belongs_to :fanable, :polymorphic => true | ||
has_and_belongs_to_many :teams | ||
|
||
validates_presence_of(:name) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
en: | ||
activerecord: | ||
activerecord: &en_attributes | ||
attributes: | ||
fan: | ||
name: His Name | ||
team: | ||
manager: Team Manager | ||
fans: Some Fans | ||
mongoid: | ||
*en_attributes | ||
fr: | ||
activerecord: | ||
activerecord: &fr_attributes | ||
attributes: | ||
fan: | ||
name: Son nom | ||
team: | ||
manager: Manager de l'équipe | ||
fans: Quelques fans | ||
mongoid: | ||
*fr_attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
class Player | ||
include Mongoid::Document | ||
include Mongoid::Timestamps | ||
|
||
field :deleted_at, :type => DateTime | ||
belongs_to :team, :inverse_of => :players | ||
field :name, :type => String | ||
field :position, :type => String | ||
field :number, :type => Integer | ||
field :retired, :type => Boolean | ||
field :injured, :type => Boolean | ||
field :born_on, :type => Date | ||
field :notes, :type => String | ||
field :suspended, :type => Boolean | ||
|
||
validates_presence_of(:name) | ||
validates_numericality_of(:number, :only_integer => true) | ||
validates_uniqueness_of(:number, :scope => :team_id, :message => "There is already a player with that number on this team") | ||
|
||
validates_each :name do |record, attr, value| | ||
record.errors.add(:base, "Player is cheating") if value.to_s =~ /on steroids/ | ||
end | ||
|
||
has_one :draft, :dependent => :destroy | ||
has_many :comments, :as => :commentable | ||
attr_protected :suspended | ||
|
||
def draft_id | ||
self.draft.try :id | ||
end | ||
|
||
def draft_id=(id) | ||
self.draft = Draft.where(:_id => id).first | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.