migrate to Rails 4.0 (closes foodcoops#214)

Conflicts:
	Gemfile.lock
This commit is contained in:
wvengen 2014-02-20 15:04:53 +01:00
parent 12d1221bfc
commit 7841245795
97 changed files with 659 additions and 557 deletions

View file

@ -17,8 +17,8 @@ class Page < ActiveRecord::Base
before_validation :update_permalink, :on => :update
after_update :create_redirect
scope :non_redirected, :conditions => {:redirect => nil}
scope :no_parent, :conditions => {:parent_id => nil}
scope :non_redirected, -> { where(:redirect => nil) }
scope :no_parent, -> { where(:parent_id => nil) }
def self.permalink(title)
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")

View file

@ -7,7 +7,7 @@
= simple_form_for @page do |f|
= f.hidden_field :lock_version
= f.input :title, input_html: {class: 'input-xxlarge'}
= f.input :body, input_html: {class: 'input-xxlarge'}
= f.input :body, input_html: {class: 'input-xxlarge', rows: 20}
= f.input :parent_id, as: :select, collection: parent_pages_to_select(@page)
.form-actions
= button_tag :name => 'preview', class: 'btn' do

View file

@ -47,5 +47,5 @@
= link_to edit_page_path(@page), class: 'btn btn-primary' do
%i.icon-edit= t '.edit'
= link_to t('.delete'), @page, class: 'btn btn-danger', :method => :delete,
:confirm => t('.delete_confirm')
:data => {:confirm => t('.delete_confirm')}
!= '| ' + t('.last_updated', user: show_user(@page.user), when: format_datetime(@page.updated_at))

View file

@ -7,8 +7,8 @@ Rails.application.routes.draw do
get :version, :on => :member
get :revert, :on => :member
end
match '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
match '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
get '/wiki/:permalink' => 'pages#show', :as => 'wiki_page' # , :constraints => {:permalink => /[^\s]+/}
get '/wiki' => 'pages#show', :defaults => {:permalink => 'Home'}, :as => 'wiki'
end

View file

@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*"] + ["Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.2.15"
s.add_dependency "rails"
s.add_dependency 'wikicloth'
s.add_dependency 'acts_as_versioned' # need git version, make sure that is included in foodsoft's Gemfile
s.add_dependency 'diffy'

View file

@ -1,31 +0,0 @@
desc "Checks your app and gently warns you if you are using deprecated code."
task :deprecated => :environment do
deprecated = {
'@params' => 'Use params[] instead',
'@session' => 'Use session[] instead',
'@flash' => 'Use flash[] instead',
'@request' => 'Use request[] instead',
'@env' => 'Use env[] instead',
'find_all\([^_]\|$\)' => 'Use find(:all) instead',
'find_first' => 'Use find(:first) instead',
'render_partial' => 'Use render :partial instead',
'component' => 'Use of components are frowned upon',
'paginate' => 'The default paginator is slow. Writing your own may be faster',
'start_form_tag' => 'Use form_for instead',
'end_form_tag' => 'Use form_for instead',
':post => true' => 'Use :method => :post instead'
}
deprecated.each do |key, warning|
puts '--> ' + key
output = `cd '#{File.expand_path('app', RAILS_ROOT)}' && grep -n --exclude=*.svn* --exclude=.#* -r '#{key}' *`
unless output =~ /^$/
puts " !! " + warning + " !!"
puts ' ' + '.' * (warning.length + 6)
puts output
else
puts " Clean! Cheers for you!"
end
puts
end
end