From 149996fc932d9b42257f0b7215c4d7f65dfef82d Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Tue, 30 Oct 2012 17:07:18 +1000 Subject: [PATCH 1/2] modified: Gemfile modified: Gemfile.lock -- added a couple new gems, date validator and something else new file: app/assets/javascripts/audio_events.js.coffee new file: app/assets/javascripts/audio_recordings.js.coffee new file: app/assets/stylesheets/audio_events.css.scss new file: app/assets/stylesheets/audio_recordings.css.scss new file: app/controllers/audio_events_controller.rb new file: app/controllers/audio_recordings_controller.rb new file: app/helpers/audio_events_helper.rb new file: app/helpers/audio_recordings_helper.rb new file: app/models/audio_event.rb new file: app/models/audio_recording.rb new file: app/views/audio_events/_form.html.erb new file: app/views/audio_events/edit.html.erb new file: app/views/audio_events/index.html.erb new file: app/views/audio_events/new.html.erb new file: app/views/audio_events/show.html.erb new file: app/views/audio_recordings/_form.html.erb new file: app/views/audio_recordings/edit.html.erb new file: app/views/audio_recordings/index.html.erb new file: app/views/audio_recordings/new.html.erb new file: app/views/audio_recordings/show.html.erb new file: db/migrate/20121030015347_create_audio_recordings.rb new file: db/migrate/20121030060408_create_audio_events.rb new file: test/fixtures/audio_events.yml new file: test/fixtures/audio_recordings.yml new file: test/functional/audio_events_controller_test.rb new file: test/functional/audio_recordings_controller_test.rb new file: test/unit/audio_event_test.rb new file: test/unit/audio_recording_test.rb new file: test/unit/helpers/audio_events_helper_test.rb new file: test/unit/helpers/audio_recordings_helper_test.rb -- added scaffolding for audio_recordings and audio_events, also added validation for most of them modified: app/controllers/application_controller.rb -- added bug note modified: app/models/project.rb modified: app/models/site.rb -- added user associations (not automatically generated because of user stamp) new file: config/initializers/validates_timeliness.rb new file: config/locales/validates_timeliness.en.yml -- setup for time validator stuff modified: config/routes.rb -- no change new file: lib/modules/uuid_helper.rb -- the check in for the guid generator --- .idea/qubar.site.iml | 5 +- app/assets/javascripts/audio_events.js.coffee | 3 + .../javascripts/audio_recordings.js.coffee | 3 + app/assets/stylesheets/audio_events.css.scss | 3 + .../stylesheets/audio_recordings.css.scss | 3 + app/controllers/application_controller.rb | 4 +- app/controllers/audio_events_controller.rb | 83 +++++++++++++++++++ .../audio_recordings_controller.rb | 83 +++++++++++++++++++ app/helpers/audio_events_helper.rb | 2 + app/helpers/audio_recordings_helper.rb | 2 + app/models/audio_event.rb | 32 +++++++ app/models/audio_recording.rb | 36 ++++++++ app/models/project.rb | 4 +- app/models/site.rb | 3 +- app/views/audio_events/_form.html.erb | 41 +++++++++ app/views/audio_events/edit.html.erb | 6 ++ app/views/audio_events/index.html.erb | 33 ++++++++ app/views/audio_events/new.html.erb | 5 ++ app/views/audio_events/show.html.erb | 35 ++++++++ app/views/audio_recordings/_form.html.erb | 65 +++++++++++++++ app/views/audio_recordings/edit.html.erb | 6 ++ app/views/audio_recordings/index.html.erb | 45 ++++++++++ app/views/audio_recordings/new.html.erb | 5 ++ app/views/audio_recordings/show.html.erb | 65 +++++++++++++++ lib/modules/uuid_helper.rb | 15 ++++ 25 files changed, 581 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/audio_events.js.coffee create mode 100644 app/assets/javascripts/audio_recordings.js.coffee create mode 100644 app/assets/stylesheets/audio_events.css.scss create mode 100644 app/assets/stylesheets/audio_recordings.css.scss create mode 100644 app/controllers/audio_events_controller.rb create mode 100644 app/controllers/audio_recordings_controller.rb create mode 100644 app/helpers/audio_events_helper.rb create mode 100644 app/helpers/audio_recordings_helper.rb create mode 100644 app/models/audio_event.rb create mode 100644 app/models/audio_recording.rb create mode 100644 app/views/audio_events/_form.html.erb create mode 100644 app/views/audio_events/edit.html.erb create mode 100644 app/views/audio_events/index.html.erb create mode 100644 app/views/audio_events/new.html.erb create mode 100644 app/views/audio_events/show.html.erb create mode 100644 app/views/audio_recordings/_form.html.erb create mode 100644 app/views/audio_recordings/edit.html.erb create mode 100644 app/views/audio_recordings/index.html.erb create mode 100644 app/views/audio_recordings/new.html.erb create mode 100644 app/views/audio_recordings/show.html.erb create mode 100644 lib/modules/uuid_helper.rb diff --git a/.idea/qubar.site.iml b/.idea/qubar.site.iml index 30095cb2..2d5d7405 100644 --- a/.idea/qubar.site.iml +++ b/.idea/qubar.site.iml @@ -65,7 +65,7 @@ - + @@ -78,10 +78,11 @@ - + + diff --git a/app/assets/javascripts/audio_events.js.coffee b/app/assets/javascripts/audio_events.js.coffee new file mode 100644 index 00000000..76156794 --- /dev/null +++ b/app/assets/javascripts/audio_events.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/audio_recordings.js.coffee b/app/assets/javascripts/audio_recordings.js.coffee new file mode 100644 index 00000000..76156794 --- /dev/null +++ b/app/assets/javascripts/audio_recordings.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/audio_events.css.scss b/app/assets/stylesheets/audio_events.css.scss new file mode 100644 index 00000000..c5dc1584 --- /dev/null +++ b/app/assets/stylesheets/audio_events.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the AudioEvents controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/audio_recordings.css.scss b/app/assets/stylesheets/audio_recordings.css.scss new file mode 100644 index 00000000..ffcfc6c0 --- /dev/null +++ b/app/assets/stylesheets/audio_recordings.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the AudioRecordings controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ab83d5fc..c784546d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,8 +7,8 @@ class ApplicationController < ActionController::Base private def set_stamper - # I expect this to fail - # hack while we have no authentication + # BUG: I expect this to fail + # TODO: hack while we have no authentication User.stamper = User.first() #self.current_user end end diff --git a/app/controllers/audio_events_controller.rb b/app/controllers/audio_events_controller.rb new file mode 100644 index 00000000..89541d74 --- /dev/null +++ b/app/controllers/audio_events_controller.rb @@ -0,0 +1,83 @@ +class AudioEventsController < ApplicationController + # GET /audio_events + # GET /audio_events.json + def index + @audio_events = AudioEvent.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @audio_events } + end + end + + # GET /audio_events/1 + # GET /audio_events/1.json + def show + @audio_event = AudioEvent.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @audio_event } + end + end + + # GET /audio_events/new + # GET /audio_events/new.json + def new + @audio_event = AudioEvent.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @audio_event } + end + end + + # GET /audio_events/1/edit + def edit + @audio_event = AudioEvent.find(params[:id]) + end + + # POST /audio_events + # POST /audio_events.json + def create + @audio_event = AudioEvent.new(params[:audio_event]) + + respond_to do |format| + if @audio_event.save + format.html { redirect_to @audio_event, notice: 'Audio event was successfully created.' } + format.json { render json: @audio_event, status: :created, location: @audio_event } + else + format.html { render action: "new" } + format.json { render json: @audio_event.errors, status: :unprocessable_entity } + end + end + end + + # PUT /audio_events/1 + # PUT /audio_events/1.json + def update + @audio_event = AudioEvent.find(params[:id]) + + respond_to do |format| + if @audio_event.update_attributes(params[:audio_event]) + format.html { redirect_to @audio_event, notice: 'Audio event was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @audio_event.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /audio_events/1 + # DELETE /audio_events/1.json + def destroy + @audio_event = AudioEvent.find(params[:id]) + @audio_event.destroy + + respond_to do |format| + format.html { redirect_to audio_events_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/audio_recordings_controller.rb b/app/controllers/audio_recordings_controller.rb new file mode 100644 index 00000000..1de8fce4 --- /dev/null +++ b/app/controllers/audio_recordings_controller.rb @@ -0,0 +1,83 @@ +class AudioRecordingsController < ApplicationController + # GET /audio_recordings + # GET /audio_recordings.json + def index + @audio_recordings = AudioRecording.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @audio_recordings } + end + end + + # GET /audio_recordings/1 + # GET /audio_recordings/1.json + def show + @audio_recording = AudioRecording.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @audio_recording } + end + end + + # GET /audio_recordings/new + # GET /audio_recordings/new.json + def new + @audio_recording = AudioRecording.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @audio_recording } + end + end + + # GET /audio_recordings/1/edit + def edit + @audio_recording = AudioRecording.find(params[:id]) + end + + # POST /audio_recordings + # POST /audio_recordings.json + def create + @audio_recording = AudioRecording.new(params[:audio_recording]) + + respond_to do |format| + if @audio_recording.save + format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully created.' } + format.json { render json: @audio_recording, status: :created, location: @audio_recording } + else + format.html { render action: "new" } + format.json { render json: @audio_recording.errors, status: :unprocessable_entity } + end + end + end + + # PUT /audio_recordings/1 + # PUT /audio_recordings/1.json + def update + @audio_recording = AudioRecording.find(params[:id]) + + respond_to do |format| + if @audio_recording.update_attributes(params[:audio_recording]) + format.html { redirect_to @audio_recording, notice: 'Audio recording was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @audio_recording.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /audio_recordings/1 + # DELETE /audio_recordings/1.json + def destroy + @audio_recording = AudioRecording.find(params[:id]) + @audio_recording.destroy + + respond_to do |format| + format.html { redirect_to audio_recordings_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/audio_events_helper.rb b/app/helpers/audio_events_helper.rb new file mode 100644 index 00000000..f4b97b89 --- /dev/null +++ b/app/helpers/audio_events_helper.rb @@ -0,0 +1,2 @@ +module AudioEventsHelper +end diff --git a/app/helpers/audio_recordings_helper.rb b/app/helpers/audio_recordings_helper.rb new file mode 100644 index 00000000..d6656ae4 --- /dev/null +++ b/app/helpers/audio_recordings_helper.rb @@ -0,0 +1,2 @@ +module AudioRecordingsHelper +end diff --git a/app/models/audio_event.rb b/app/models/audio_event.rb new file mode 100644 index 00000000..964c70f4 --- /dev/null +++ b/app/models/audio_event.rb @@ -0,0 +1,32 @@ +class AudioEvent < ActiveRecord::Base + belongs_to :audio_recording + + attr_accessible :end_time_seconds, :high_frequency_hertz, :is_reference, :low_frequency_hertz, :start_time_seconds + + # userstamp + stampable + belongs_to :user + acts_as_paranoid + + # validation + validates :start_time_seconds, :presence => true, :numericality => { :greater_than_or_equal_to => 0 } + validates :end_time_seconds, :presence => true, :numericality => { :greater_than_or_equal_to => 0 } + validates :start_time_must_be_less_than_end_time, :presence => true + + validates :low_frequency_hertz, :presence => true, :numericality => { :greater_than_or_equal_to => 0 } + validates :high_frequency_hertz, :presence => true, :numericality => { :greater_than_or_equal_to => 0 } + validates :low_frequency_must_be_less_than_or_equal_to_high_frequency, :presence => true + + # custom validation methods + def start_time_must_be_less_than_or_equal_to_end_time + if start_time_seconds > end_time_seconds then + errors.add(:start_time_seconds, "must be lower than end time") + end + end + + def low_frequency_must_be_less_than_or_equal_to_high_frequency + if low_frequency_hertz > high_frequency_hertz then + errors.add(:start_time_seconds, "must be lower than high frequency") + end + end +end diff --git a/app/models/audio_recording.rb b/app/models/audio_recording.rb new file mode 100644 index 00000000..a5e922a0 --- /dev/null +++ b/app/models/audio_recording.rb @@ -0,0 +1,36 @@ +class AudioRecording < ActiveRecord::Base + store :notes + belongs_to :user + belongs_to :site + attr_accessible :bit_rate_bps, :channels, :data_length_bytes, + :duration_seconds, :hash, :media_type, :notes, + :recorded_date, :sample_rate_hertz, :status + + stampable + acts_as_paranoid + + # validation + validates :uuid, :presence => true, :length => {:is => 36} + validates :user, :presence => true + + validates :recorded_date, :presence => true, :on_or_before => :today + validates :site, :presence => true + validates :duration_seconds, :presence => true, :numericality => { :greater_than_or_equal_to => 0 } + + validates :sample_rate_hertz, :numericality => { :only_integer => true, :greater_than => 0 } + validates :channels, :presence => true, :numericality => { :only_integer => true, :greater_than => 0 } + validates :bit_rate_bps, :numericality => { :only_integer => true, :greater_than => 0 } + validates :media_type, :presence => true + validates :data_length_bytes, :presence => true, :numericality => { :only_integer => true, :greater_than_or_equal_to => 0 } + + validates :hash, :presence => true + + + # uuid stuff + attr_protected :uuid + validates_presence_of :uuid + validates_uniqueness_of :uuid + + include UUIDHelper + +end diff --git a/app/models/project.rb b/app/models/project.rb index b91326cc..3ad04e1a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -5,10 +5,12 @@ class Project < ActiveRecord::Base has_many :photos, :as => :imageable has_many :project_sites has_many :sites, :through => :project_sites + accepts_nested_attributes_for :sites - + # userstamp stampable + belongs_to :user validates :name, :presence => true end diff --git a/app/models/site.rb b/app/models/site.rb index f5f0d624..fafa4f1f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -7,7 +7,8 @@ class Site < ActiveRecord::Base # userstamp stampable - + belongs_to :user + validates :name, :presence => true, :length => { :minimum => 2 } validates :latitude, :presence => true, :numericality => true validates :longitude, :presence => true, :numericality => true diff --git a/app/views/audio_events/_form.html.erb b/app/views/audio_events/_form.html.erb new file mode 100644 index 00000000..e7fc8a4b --- /dev/null +++ b/app/views/audio_events/_form.html.erb @@ -0,0 +1,41 @@ +<%= form_for(@audio_event) do |f| %> + <% if @audio_event.errors.any? %> +
+

<%= pluralize(@audio_event.errors.count, "error") %> prohibited this audio_event from being saved:

+ +
    + <% @audio_event.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :audio_recording %>
+ <%= f.text_field :audio_recording %> +
+
+ <%= f.label :start_time_seconds %>
+ <%= f.text_field :start_time_seconds %> +
+
+ <%= f.label :end_time_seconds %>
+ <%= f.text_field :end_time_seconds %> +
+
+ <%= f.label :low_frequency_hertz %>
+ <%= f.text_field :low_frequency_hertz %> +
+
+ <%= f.label :high_frequency %>
+ <%= f.text_field :high_frequency %> +
+
+ <%= f.label :is_reference %>
+ <%= f.text_field :is_reference %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/audio_events/edit.html.erb b/app/views/audio_events/edit.html.erb new file mode 100644 index 00000000..f6fce34f --- /dev/null +++ b/app/views/audio_events/edit.html.erb @@ -0,0 +1,6 @@ +

Editing audio_event

+ +<%= render 'form' %> + +<%= link_to 'Show', @audio_event %> | +<%= link_to 'Back', audio_events_path %> diff --git a/app/views/audio_events/index.html.erb b/app/views/audio_events/index.html.erb new file mode 100644 index 00000000..da8920a5 --- /dev/null +++ b/app/views/audio_events/index.html.erb @@ -0,0 +1,33 @@ +

Listing audio_events

+ + + + + + + + + + + + + + +<% @audio_events.each do |audio_event| %> + + + + + + + + + + + +<% end %> +
Audio recordingStart time secondsEnd time secondsLow frequency hertzHigh frequencyIs reference
<%= audio_event.audio_recording %><%= audio_event.start_time_seconds %><%= audio_event.end_time_seconds %><%= audio_event.low_frequency_hertz %><%= audio_event.high_frequency %><%= audio_event.is_reference %><%= link_to 'Show', audio_event %><%= link_to 'Edit', edit_audio_event_path(audio_event) %><%= link_to 'Destroy', audio_event, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Audio event', new_audio_event_path %> diff --git a/app/views/audio_events/new.html.erb b/app/views/audio_events/new.html.erb new file mode 100644 index 00000000..aff87193 --- /dev/null +++ b/app/views/audio_events/new.html.erb @@ -0,0 +1,5 @@ +

New audio_event

+ +<%= render 'form' %> + +<%= link_to 'Back', audio_events_path %> diff --git a/app/views/audio_events/show.html.erb b/app/views/audio_events/show.html.erb new file mode 100644 index 00000000..1fe02e72 --- /dev/null +++ b/app/views/audio_events/show.html.erb @@ -0,0 +1,35 @@ +

<%= notice %>

+ +

+ Audio recording: + <%= @audio_event.audio_recording %> +

+ +

+ Start time seconds: + <%= @audio_event.start_time_seconds %> +

+ +

+ End time seconds: + <%= @audio_event.end_time_seconds %> +

+ +

+ Low frequency hertz: + <%= @audio_event.low_frequency_hertz %> +

+ +

+ High frequency: + <%= @audio_event.high_frequency %> +

+ +

+ Is reference: + <%= @audio_event.is_reference %> +

+ + +<%= link_to 'Edit', edit_audio_event_path(@audio_event) %> | +<%= link_to 'Back', audio_events_path %> diff --git a/app/views/audio_recordings/_form.html.erb b/app/views/audio_recordings/_form.html.erb new file mode 100644 index 00000000..4a0eb4e3 --- /dev/null +++ b/app/views/audio_recordings/_form.html.erb @@ -0,0 +1,65 @@ +<%= form_for(@audio_recording) do |f| %> + <% if @audio_recording.errors.any? %> +
+

<%= pluralize(@audio_recording.errors.count, "error") %> prohibited this audio_recording from being saved:

+ +
    + <% @audio_recording.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :user %>
+ <%= f.text_field :user %> +
+
+ <%= f.label :recorded_date %>
+ <%= f.datetime_select :recorded_date %> +
+
+ <%= f.label :site %>
+ <%= f.text_field :site %> +
+
+ <%= f.label :duration_seconds %>
+ <%= f.text_field :duration_seconds %> +
+
+ <%= f.label :sample_rate_hertz %>
+ <%= f.number_field :sample_rate_hertz %> +
+
+ <%= f.label :channels %>
+ <%= f.number_field :channels %> +
+
+ <%= f.label :bit_rate_bps %>
+ <%= f.number_field :bit_rate_bps %> +
+
+ <%= f.label :media_type %>
+ <%= f.text_field :media_type %> +
+
+ <%= f.label :data_length_bytes %>
+ <%= f.number_field :data_length_bytes %> +
+
+ <%= f.label :hash %>
+ <%= f.text_field :hash %> +
+
+ <%= f.label :status %>
+ <%= f.text_field :status %> +
+
+ <%= f.label :notes %>
+ <%= f.text_area :notes %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/audio_recordings/edit.html.erb b/app/views/audio_recordings/edit.html.erb new file mode 100644 index 00000000..9ec4c0d5 --- /dev/null +++ b/app/views/audio_recordings/edit.html.erb @@ -0,0 +1,6 @@ +

Editing audio_recording

+ +<%= render 'form' %> + +<%= link_to 'Show', @audio_recording %> | +<%= link_to 'Back', audio_recordings_path %> diff --git a/app/views/audio_recordings/index.html.erb b/app/views/audio_recordings/index.html.erb new file mode 100644 index 00000000..71961258 --- /dev/null +++ b/app/views/audio_recordings/index.html.erb @@ -0,0 +1,45 @@ +

Listing audio_recordings

+ + + + + + + + + + + + + + + + + + + + +<% @audio_recordings.each do |audio_recording| %> + + + + + + + + + + + + + + + + + +<% end %> +
UserRecorded dateSiteDuration secondsSample rate hertzChannelsBit rate bpsMedia typeData length bytesHashStatusNotes
<%= audio_recording.user %><%= audio_recording.recorded_date %><%= audio_recording.site %><%= audio_recording.duration_seconds %><%= audio_recording.sample_rate_hertz %><%= audio_recording.channels %><%= audio_recording.bit_rate_bps %><%= audio_recording.media_type %><%= audio_recording.data_length_bytes %><%= audio_recording.hash %><%= audio_recording.status %><%= audio_recording.notes %><%= link_to 'Show', audio_recording %><%= link_to 'Edit', edit_audio_recording_path(audio_recording) %><%= link_to 'Destroy', audio_recording, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Audio recording', new_audio_recording_path %> diff --git a/app/views/audio_recordings/new.html.erb b/app/views/audio_recordings/new.html.erb new file mode 100644 index 00000000..e21aee11 --- /dev/null +++ b/app/views/audio_recordings/new.html.erb @@ -0,0 +1,5 @@ +

New audio_recording

+ +<%= render 'form' %> + +<%= link_to 'Back', audio_recordings_path %> diff --git a/app/views/audio_recordings/show.html.erb b/app/views/audio_recordings/show.html.erb new file mode 100644 index 00000000..51a24682 --- /dev/null +++ b/app/views/audio_recordings/show.html.erb @@ -0,0 +1,65 @@ +

<%= notice %>

+ +

+ User: + <%= @audio_recording.user %> +

+ +

+ Recorded date: + <%= @audio_recording.recorded_date %> +

+ +

+ Site: + <%= @audio_recording.site %> +

+ +

+ Duration seconds: + <%= @audio_recording.duration_seconds %> +

+ +

+ Sample rate hertz: + <%= @audio_recording.sample_rate_hertz %> +

+ +

+ Channels: + <%= @audio_recording.channels %> +

+ +

+ Bit rate bps: + <%= @audio_recording.bit_rate_bps %> +

+ +

+ Media type: + <%= @audio_recording.media_type %> +

+ +

+ Data length bytes: + <%= @audio_recording.data_length_bytes %> +

+ +

+ Hash: + <%= @audio_recording.hash %> +

+ +

+ Status: + <%= @audio_recording.status %> +

+ +

+ Notes: + <%= @audio_recording.notes %> +

+ + +<%= link_to 'Edit', edit_audio_recording_path(@audio_recording) %> | +<%= link_to 'Back', audio_recordings_path %> diff --git a/lib/modules/uuid_helper.rb b/lib/modules/uuid_helper.rb new file mode 100644 index 00000000..12b8c00d --- /dev/null +++ b/lib/modules/uuid_helper.rb @@ -0,0 +1,15 @@ +require 'rubygems' +require 'uuidtools' +# http://stackoverflow.com/questions/2487837/uuids-in-rails3 +# http://railsforum.com/viewtopic.php?pid=104690#p104690 +module UUIDHelper + def self.included(base) + base.class_eval do + before_validation_on_create :set_uuid + + def set_uuid + self.uuid = UUID.timestamp_create.to_s + end + end + end +end \ No newline at end of file From 6dc002a7b3bf9361b0c8c6c23e3af03232c4d0aa Mon Sep 17 00:00:00 2001 From: antmt Date: Wed, 31 Oct 2012 10:02:55 +1000 Subject: [PATCH 2/2] fixed invalid params for rake --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d3026239..abb06b8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_script: - sh vendor/bin/install_console_audio_tools.sh script: - ls -la - - RAILS_ENV=test bundle exec rake --trace db:migrate + - RAILS_ENV=test bundle exec rake db:migrate --trace - RAILS_ENV=test bundle exec rake --trace notifications: webhooks: http://build.ecosounds.org/build \ No newline at end of file