mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 17:50:13 +01:00
Removed superfluous 'tracks' directory at the root of the repository.
Testing commits to github.
This commit is contained in:
parent
6a42901514
commit
4cbf5a34d3
2269 changed files with 0 additions and 0 deletions
69
vendor/plugins/has_many_polymorphs/examples/hmph.rb
vendored
Normal file
69
vendor/plugins/has_many_polymorphs/examples/hmph.rb
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
require 'camping'
|
||||
require 'has_many_polymorphs'
|
||||
|
||||
Camping.goes :Hmph
|
||||
|
||||
module Hmph::Models
|
||||
class GuestsKennel < Base
|
||||
belongs_to :kennel
|
||||
belongs_to :guest, :polymorphic => true
|
||||
end
|
||||
|
||||
class Dog < Base
|
||||
end
|
||||
|
||||
class Cat < Base
|
||||
end
|
||||
|
||||
class Bird < Base
|
||||
end
|
||||
|
||||
class Kennel < Base
|
||||
has_many_polymorphs :guests,
|
||||
:from => [:dogs, :cats, :birds],
|
||||
:through => :guests_kennels,
|
||||
:namespace => :"hmph/models/"
|
||||
end
|
||||
|
||||
class InitialSchema < V 1.0
|
||||
def self.up
|
||||
create_table :hmph_kennels do |t|
|
||||
t.column :created_at, :datetime
|
||||
t.column :modified_at, :datetime
|
||||
t.column :name, :string, :default => 'Anonymous Kennel'
|
||||
end
|
||||
|
||||
create_table :hmph_guests_kennels do |t|
|
||||
t.column :guest_id, :integer
|
||||
t.column :guest_type, :string
|
||||
t.column :kennel_id, :integer
|
||||
end
|
||||
|
||||
create_table :hmph_dogs do |t|
|
||||
t.column :name, :string, :default => 'Fido'
|
||||
end
|
||||
|
||||
create_table :hmph_cats do |t|
|
||||
t.column :name, :string, :default => 'Morris'
|
||||
end
|
||||
|
||||
create_table :hmph_birds do |t|
|
||||
t.column :name, :string, :default => 'Polly'
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :hmph_kennels
|
||||
drop_table :hmph_guests_kennels
|
||||
drop_table :hmph_dogs
|
||||
drop_table :hmph_cats
|
||||
drop_table :hmph_birds
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Hmph::Controllers
|
||||
end
|
||||
|
||||
module Hmph::Views
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue