Class: RestAssured::Models::Redirect
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- RestAssured::Models::Redirect
- Defined in:
- lib/rest-assured/models/redirect.rb
Class Method Summary collapse
Class Method Details
.find_redirect_url_for(fullpath) ⇒ Object
12 13 14 15 16 |
# File 'lib/rest-assured/models/redirect.rb', line 12 def self.find_redirect_url_for(fullpath) if redirect = ordered.find { |r| fullpath =~ /#{r.pattern}/ } fullpath.sub /#{redirect.pattern}/, redirect.to end end |
.update_order(ordered_redirect_ids) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rest-assured/models/redirect.rb', line 18 def self.update_order(ordered_redirect_ids) success = true transaction do begin ordered_redirect_ids.each_with_index do |r_id, idx| r = find(r_id) r.position = idx r.save! end rescue => e # TODO log exception puts e.inspect success = false raise ActiveRecord::Rollback end end success end |