Skip to content

Commit

Permalink
Worked on creating some better seed data for dev work
Browse files Browse the repository at this point in the history
modified:   app/models/audio_recording.rb
modified:   db/migrate/20121030015347_create_audio_recordings.rb
	-- fixed badly named foreign key

modified:   app/models/project.rb
	-- important, added uniqueness constraint to project names'

new file:   db/development_seeds.rb
modified:   db/schema.rb
modified:   db/seeds.rb
	-- seed data creation
  • Loading branch information
atruskie committed Nov 7, 2012
1 parent ec2090b commit 76dbf4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions app/assets/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ <h2>Welcome</h2>

<p>{{welcomeMessage}}</p>

<a href="#/projects">Projects</a>
<a href="#/sites">Sites</a>
<a href="#/photos">Photos</a>
<a href="#/recordings">Audio Recordings</a>
<a href="/projects">Projects</a>
<a href="/sites">Sites</a>
<a href="/photos">Photos</a>
<a href="/recordings">Audio Recordings</a>

5 changes: 3 additions & 2 deletions app/models/audio_recording.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ class AudioRecording < ActiveRecord::Base
# relations
belongs_to :site
has_many :audio_events
belongs_to :user, :class_name => 'User', :foreign_key => "uploader_id"

# attr
attr_accessible :bit_rate_bps, :channels, :data_length_bytes,
:duration_seconds, :file_hash, :media_type, :notes,
:recorded_date, :sample_rate_hertz, :status
:recorded_date, :sample_rate_hertz, :status, :uploader_id

# userstamp
stampable
Expand All @@ -21,7 +22,7 @@ class AudioRecording < ActiveRecord::Base

# validation
validates :uuid, :presence => true, :length => {:is => 36}, :uniqueness => { :case_sensitive => false }
validates :user, :presence => true
validates :uploader_id, :presence => true


validates :recorded_date, :presence => true, :timeliness => {:on_or_before => lambda { Date.current }, :type => :date }
Expand Down
2 changes: 1 addition & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Project < ActiveRecord::Base
validates_as_paranoid

# validation
validates :name, :presence => true
validates :name, :presence => true, :uniqueness => { :case_sensitive => false }
validates :urn, :presence => true

end

0 comments on commit 76dbf4c

Please sign in to comment.