acts_as_paranoid_versioned and routes
This commit is contained in:
6
Gemfile
6
Gemfile
@@ -19,9 +19,13 @@ gem 'will_paginate', "~>3.0"
|
||||
gem 'calendar_helper', "~>0.2"
|
||||
gem 'shoulda', "~>2.11"
|
||||
gem 'acts_as_paranoid', '~>0.4'
|
||||
#gem 'acts_as_versioned', '~>0.6', :ignore_dependencies => true
|
||||
gem 'acts_as_versioned', :git => 'https://github.com/jwhitehorn/acts_as_versioned.git'
|
||||
gem 'acts_as_list', '~>0.2'
|
||||
|
||||
group :development, :production do
|
||||
gem 'brazilian-rails', '3.3.0', :path => './vendor/gems/brazilian-rails/brI18n/'
|
||||
end
|
||||
|
||||
group :development do
|
||||
gem 'mongrel'
|
||||
end
|
||||
|
||||
18
Gemfile.lock
18
Gemfile.lock
@@ -1,3 +1,10 @@
|
||||
GIT
|
||||
remote: https://github.com/jwhitehorn/acts_as_versioned.git
|
||||
revision: 44dfe632ba8c97c786cbc172a2da18a41b17f668
|
||||
specs:
|
||||
acts_as_versioned (3.2.1)
|
||||
activerecord
|
||||
|
||||
PATH
|
||||
remote: ./vendor/gems/bluecloth
|
||||
specs:
|
||||
@@ -46,6 +53,7 @@ GEM
|
||||
builder (3.0.4)
|
||||
calendar_helper (0.2.5)
|
||||
open4
|
||||
cgi_multipart_eof_fix (2.5.0)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
@@ -53,9 +61,12 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.6.3)
|
||||
daemons (1.1.9)
|
||||
erubis (2.7.0)
|
||||
execjs (1.4.0)
|
||||
multi_json (~> 1.0)
|
||||
fastthread (1.0.7)
|
||||
gem_plugin (0.2.3)
|
||||
haml (3.1.8)
|
||||
hike (1.2.3)
|
||||
hpricot (0.8.6)
|
||||
@@ -70,6 +81,11 @@ GEM
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.23)
|
||||
mongrel (1.1.5)
|
||||
cgi_multipart_eof_fix (>= 2.4)
|
||||
daemons (>= 1.0.3)
|
||||
fastthread (>= 1.0.1)
|
||||
gem_plugin (>= 0.2.3)
|
||||
multi_json (1.7.7)
|
||||
open4 (1.3.0)
|
||||
polyglot (0.3.3)
|
||||
@@ -127,6 +143,7 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
acts_as_list (~> 0.2)
|
||||
acts_as_paranoid (~> 0.4)
|
||||
acts_as_versioned!
|
||||
bluecloth (= 1.0.0)!
|
||||
brazilian-rails (= 3.3.0)!
|
||||
calendar_helper (~> 0.2)
|
||||
@@ -136,6 +153,7 @@ DEPENDENCIES
|
||||
icalendar (~> 1.0)
|
||||
jquery-rails
|
||||
json
|
||||
mongrel
|
||||
rails (~> 3.2)
|
||||
sass-rails (~> 3.2.3)
|
||||
shoulda (~> 2.11)
|
||||
|
||||
@@ -19,7 +19,7 @@ class String
|
||||
def format_wiki
|
||||
text = BlueCloth.new(self).to_html
|
||||
text = Hpricot(text, :xhtml_strict => true).to_s
|
||||
return text.sanitize
|
||||
return text.sanitize unless text.blank?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,12 @@ class Event < ActiveRecord::Base
|
||||
# Plugins
|
||||
acts_as_paranoid
|
||||
acts_as_versioned :if_changed => [ :title, :description, :time ]
|
||||
acts_as_paranoid_versioned
|
||||
|
||||
#acts_as_paranoid_versioned
|
||||
self.versioned_class.class_eval do
|
||||
def self.delete_all(conditions = nil); return; end
|
||||
end
|
||||
|
||||
self.non_versioned_columns << 'deleted_at'
|
||||
|
||||
# Associacoes
|
||||
|
||||
@@ -21,7 +21,11 @@ class Message < ActiveRecord::Base
|
||||
acts_as_paranoid
|
||||
acts_as_versioned :if_changed => [ :title, :body ]
|
||||
self.non_versioned_columns << 'deleted_at'
|
||||
acts_as_paranoid_versioned
|
||||
|
||||
#acts_as_paranoid_versioned
|
||||
self.versioned_class.class_eval do
|
||||
def self.delete_all(conditions = nil); return; end
|
||||
end
|
||||
|
||||
# Associacoes
|
||||
belongs_to :user,
|
||||
|
||||
@@ -25,7 +25,6 @@ class WikiPage < ActiveRecord::Base
|
||||
acts_as_paranoid
|
||||
acts_as_list :scope => 'course_id = #{course_id}'
|
||||
acts_as_versioned :if_changed => [ :content, :description, :title ]
|
||||
acts_as_paranoid_versioned
|
||||
self.non_versioned_columns << 'front_page'
|
||||
self.non_versioned_columns << 'position'
|
||||
self.non_versioned_columns << 'deleted_at'
|
||||
@@ -43,6 +42,11 @@ class WikiPage < ActiveRecord::Base
|
||||
validates_uniqueness_of :canonical_title, :scope => :course_id
|
||||
validates_format_of :title, :with => /^[^0-9]/
|
||||
|
||||
# acts_as_paranoid_versioned
|
||||
self.versioned_class.class_eval do
|
||||
def self.delete_all(conditions = nil); return; end
|
||||
end
|
||||
|
||||
def before_validation
|
||||
self.canonical_title = self.title.pretty_url
|
||||
end
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ActiveSupport::Inflector.inflections do |inflect|
|
||||
inflect.irregular 'wiki_instance', 'wiki'
|
||||
inflect.irregular 'news_instance', 'news'
|
||||
end
|
||||
|
||||
WikiUFC::Application.routes.draw do
|
||||
|
||||
resources :users
|
||||
@@ -55,7 +60,11 @@ WikiUFC::Application.routes.draw do
|
||||
end
|
||||
|
||||
# Log
|
||||
#match 'controllerlog' => '#index', :as => :with_options
|
||||
with_options :controller => 'log' do |log|
|
||||
log.match 'courses/:course_id/log', :action => 'index', :format => 'html', :as => 'course_log'
|
||||
log.match 'courses/:course_id/log/:id/undo', :action => 'undo', :format => 'html', :as => 'undo_course_log'
|
||||
log.match 'courses/:course_id/log.:format', :action => 'index', :as => 'formatted_course_log'
|
||||
end
|
||||
|
||||
# Services
|
||||
match 'services/preview' => 'wiki#preview', :as => :preview
|
||||
|
||||
Reference in New Issue
Block a user