Skip to content

Commit

Permalink
Use forked strip_attributes
Browse files Browse the repository at this point in the history
Applies @henare's changes from 702399a.

Upgrades from the deprecated bang syntax

See #903 for more info.
  • Loading branch information
garethrees authored and crowbot committed Nov 17, 2015
1 parent c23efa8 commit 08115b2
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 267 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -32,6 +32,7 @@ gem 'rmagick', '~> 2.14.0'
gem 'ruby-msg', '~> 1.5.0', :git => 'https://github.com/mysociety/ruby-msg.git', :ref => 'f9f928ed76c024b4bc3a08bc1a59beb62df36663'
gem 'secure_headers', '~> 2.0.2'
gem 'statistics2', '~> 0.54'
gem 'strip_attributes', :git => 'https://github.com/mysociety/strip_attributes.git', :branch => 'globalize3'
gem 'syslog_protocol', '~> 0.9.2'
gem 'thin', '~> 1.5.1'
gem 'vpim', '~> 13.11.11'
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Expand Up @@ -17,6 +17,14 @@ GIT
ruby-ole (>= 1.2.8)
vpim (>= 0.360)

GIT
remote: https://github.com/mysociety/strip_attributes.git
revision: ce9e1f477bc9324074f6fbf1d3c3bb33305abb0d
branch: globalize3
specs:
strip_attributes (1.7.0)
activemodel (>= 3.0, < 5.0)

GIT
remote: https://github.com/technoweenie/acts_as_versioned.git
revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b
Expand Down Expand Up @@ -375,6 +383,7 @@ DEPENDENCIES
secure_headers (~> 2.0.2)
spork-rails (~> 3.2.1)
statistics2 (~> 0.54)
strip_attributes!
syslog_protocol (~> 0.9.2)
therubyracer (~> 0.12.0)
thin (~> 1.5.1)
Expand Down
2 changes: 1 addition & 1 deletion app/models/comment.rb
Expand Up @@ -22,7 +22,7 @@

class Comment < ActiveRecord::Base
include AdminColumn
strip_attributes!
strip_attributes :allow_empty => true

belongs_to :user
belongs_to :info_request
Expand Down
2 changes: 1 addition & 1 deletion app/models/info_request.rb
Expand Up @@ -33,7 +33,7 @@ class InfoRequest < ActiveRecord::Base

@non_admin_columns = %w(title url_title)

strip_attributes!
strip_attributes :allow_empty => true

validates_presence_of :title, :message => N_("Please enter a summary of your request")
# TODO: When we no longer support Ruby 1.8, this can be done with /[[:alpha:]]/
Expand Down
2 changes: 1 addition & 1 deletion app/models/outgoing_message.rb
Expand Up @@ -51,7 +51,7 @@ class OutgoingMessage < ActiveRecord::Base
# reindex if body text is edited (e.g. by admin interface)
after_update :xapian_reindex_after_update

strip_attributes!
strip_attributes :allow_empty => true
has_prominence

self.default_url_options[:host] = AlaveteliConfiguration.domain
Expand Down
2 changes: 1 addition & 1 deletion app/models/public_body.rb
Expand Up @@ -92,7 +92,7 @@ class ImportCSVDryRun < StandardError ; end
[:tag_array_for_search, 'U', "tag"]
]
has_tag_string
strip_attributes!
strip_attributes :allow_empty => true
translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme

# Cannot be grouped at top as it depends on the `translates` macro
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -27,7 +27,7 @@
require 'digest/sha1'

class User < ActiveRecord::Base
strip_attributes!
strip_attributes :allow_empty => true

attr_accessor :password_confirmation, :no_xapian_reindex

Expand Down
3 changes: 0 additions & 3 deletions config/initializers/strip_attributes.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/has_tag_string/has_tag_string.rb
Expand Up @@ -11,7 +11,7 @@ module HasTagString
# Represents one tag of one model.
# The migration to make this is currently only in WDTK code.
class HasTagStringTag < ActiveRecord::Base
# TODO: strip_attributes!
# TODO: strip_attributes

validates_presence_of :name

Expand Down
77 changes: 0 additions & 77 deletions lib/strip_attributes/README.rdoc

This file was deleted.

30 changes: 0 additions & 30 deletions lib/strip_attributes/Rakefile

This file was deleted.

38 changes: 0 additions & 38 deletions lib/strip_attributes/strip_attributes.rb

This file was deleted.

91 changes: 0 additions & 91 deletions lib/strip_attributes/test/strip_attributes_test.rb

This file was deleted.

21 changes: 0 additions & 21 deletions lib/strip_attributes/test/test_helper.rb

This file was deleted.

16 changes: 16 additions & 0 deletions spec/integration/globalize_strip_attributes_spec.rb
@@ -0,0 +1,16 @@
# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe 'globalize3 and strip_attributes' do

it 'strips spaces from attributes in the default locale' do
body = FactoryGirl.build(:public_body, :name => ' Trailing Spaces ')
body.translations_attributes = { :es => { :locale => 'es',
:name => ' El Body ' } }
body.save!
body.reload
expect(body.name).to eq('Trailing Spaces')
expect(body.name(:es)).to eq(' El Body ')
end

end
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -15,7 +15,6 @@
add_filter 'commonlib'
add_filter 'vendor/plugins'
add_filter 'lib/attachment_to_html'
add_filter 'lib/strip_attributes'
add_filter 'lib/has_tag_string'
add_filter 'lib/acts_as_xapian'
add_filter 'lib/themes'
Expand Down

0 comments on commit 08115b2

Please sign in to comment.