Project

General

Profile

RE: Webdav plugin » webdav_setting.rb

Terence Mill, 2011-08-02 09:29

 
1
class WebdavSetting < ActiveRecord::Base
2
  belongs_to :project
3

    
4
  def self.find_or_create(pj_id)
5
    setting = WebdavSetting.find(:first, :conditions => ['project_id = ?', pj_id])
6
    unless setting
7
      setting = WebdavSetting.new
8
      setting.project_id = pj_id
9
      setting.files_enabled = true
10
      setting.documents_enabled = true
11
      setting.subversion_enabled = false
12
      setting.subversion_only = false
13
      setting.files_label = l(:files_label)
14
      setting.documents_label = l(:documents_label)
15
      setting.subversion_label = l(:subversion_label)
16
      setting.macosx_write = false
17
      setting.save!      
18
    end
19
    return setting
20
  end
21
end
(1-1/3)