Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Dec 17, 2012
2 parents 83f74c4 + 632eedd commit 7d432b4
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/controllers/audio_events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def new
# GET /audio_events/1/edit
def edit
@audio_event =
AudioEvent.find(params[:id]).includes(:audio_event_tags)
AudioEvent.find(params[:id]).include(:audio_event_tags)
end

# POST /audio_events
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ def update

respond_to do |format|
if @project.update_attributes(params[:project])
# also delete
#format.html { redirect_to @project, notice: 'Project was successfully updated.' }
format.html { redirect_to @project, notice: 'Project was successfully updated.' }
format.json { head :no_content }
else
#format.html { render action: "edit" }
format.html { render action: "edit" }
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/analysis_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AnalysisItem < ActiveRecord::Base
belongs_to :analysis_job

# attr
attr_accessible :offset_end_seconds, :offset_start_seconds, :status, :worker_info, :worker_run_details, :worker_started_utc
attr_accessible :audio_recording_id, :offset_end_seconds, :offset_start_seconds, :status, :worker_info, :worker_run_details, :worker_started_utc

accepts_nested_attributes_for :analysis_job, :audio_recording

Expand All @@ -14,5 +14,5 @@ class AnalysisItem < ActiveRecord::Base
validates :audio_recording_id, :presence => true
# documentation for timeliness: https://github.com/adzap/validates_timeliness
validates :worker_started_utc, :timeliness => { :type => :datetime, :allow_blank => true }
validates :status, :inclusion => { :in => [:ready, :running, :complete, :error] }
validates :status, :inclusion => { :in => %w(ready running complete error) }
end
2 changes: 1 addition & 1 deletion app/models/analysis_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AnalysisJob < ActiveRecord::Base
validates :script_settings, :presence => true
validates :script_version, :presence => true
validates :script_display_name, :presence => true
validates :process_new, :inclusion => { :in => [true, false] }
validates :process_new, :inclusion => { :in => %w(true false) }
validate :data_set_cannot_process_new

# custom validation methods
Expand Down
2 changes: 1 addition & 1 deletion app/models/analysis_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class AnalysisScript < ActiveRecord::Base
validates :settings, :presence => true
validates :version, :presence => true
validates :display_name, :presence => true
validates :verified, :inclusion => { :in => [true, false] }
validates :verified, :inclusion => { :in => %w(true false) }

end
2 changes: 1 addition & 1 deletion app/models/audio_recording.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AudioRecording < ActiveRecord::Base

validates :file_hash, :presence => true

validates :status, :inclusion => { :in => [:new, :to_check, :ready, :corrupt, :ignore] }
validates :status, :inclusion => { :in => %w(new to_check ready corrupt ignore) }

# uuid stuff
attr_protected :uuid
Expand Down
2 changes: 1 addition & 1 deletion app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Tag < ActiveRecord::Base
enumerize :type_of_tag, :in => [:common_name, :species_name, :looks_like, :sounds_like], predicates: true

# validation
validates_inclusion_of :is_taxanomic, :in => [true, false]
validates :is_taxanomic, :inclusion => { :in => %w(true false) }
validates :text, :uniqueness => { :case_sensitive => false }
#validate :class_mutually_exclusive_with_tag_type

Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class User < ActiveRecord::Base
#:format => { :with => /\A[a-zA-Z0-9_ ]+\z/, :message => "only letters, numbers, space and underscore allowed" }
validates :display_name, :uniqueness => {:case_sensitive => false }, :presence => { :unless => Proc.new { |a| a.email.present? }, :message => "Please provide a name, email, or both." }
validates :email, :uniqueness => {:case_sensitive => false }, :presence => { :unless => Proc.new { |a| a.display_name.present? }, :message => "Please provide an email, name, or both." }
validates :user_name, :exclusion => { :in => %w(admin harvester analysis_runner) }
#friendly_id :display_name, :use_slug => true, :strip_non_ascii => true


Expand Down

0 comments on commit 7d432b4

Please sign in to comment.