blob: 274d11f9ff535156e8744fe3122ab0265a817b99 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 | class FileValidationsController < InheritedResources::Base
  respond_to :html, :xml, :json
  def index
    no_referential
    index!
  end
  def show
    no_referential
    @toc = TestSheetPage.find("toc")
    show!
  end
  
  def new
    no_referential
    @toc = TestSheetPage.find("toc")
    new!
  end
  def create
    no_referential
    create! do |success, failure|
      success.html { redirect_to file_validations_path }
    end
  end
  
  protected
  def no_referential
    Apartment::Database.switch("public")
  end
  
  def resource
    @file_validation ||= current_organisation.file_validations.find_by_id(params[:id])
  end
  def collection    
    @file_validations ||= current_organisation.file_validations.paginate(:page => params[:page])
  end
  def create_resource(file_validation)
    file_validation.organisation = current_organisation
    super
  end
  
end
 |