diff --git a/Gemfile b/Gemfile index b5cf99adef43149ac23c38ff304315f216038499..2db441863cf5fe74c01439609f5f99d10fe2e5d6 100644 --- a/Gemfile +++ b/Gemfile @@ -25,7 +25,7 @@ gem 'will_paginate', '3.0.pre2' gem 'i18n-inflector-rails', '~> 1.0' #Tags -gem 'acts-as-taggable-on', '2.0.6' +gem 'acts-as-taggable-on', :git => 'git://github.com/diaspora/acts-as-taggable-on.git' #Uncatagorized gem 'roxml', :git => 'git://github.com/Empact/roxml.git', :ref => '7ea9a9ffd2338aaef5b0' diff --git a/Gemfile.lock b/Gemfile.lock index cd611be097065d7805862ef39d4e30bdcb448df8..59c02c9ac3ba4ed16fcda225351e7a2ee1bdb9bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,19 @@ GIT activesupport (>= 2.3.0) nokogiri (>= 1.3.3) +GIT + remote: git://github.com/diaspora/acts-as-taggable-on.git + revision: 498089b41503af633f55bdc1d43b142e7d76e1f1 + specs: + acts-as-taggable-on (2.0.6) + jeweler + mysql + pg + rails (>= 3.0) + rcov + rspec (>= 2.0) + sqlite3-ruby + GIT remote: git://github.com/iain/http_accept_language.git revision: 0b78aa7849fc90cf9e12586af162fa4c408a795d @@ -86,7 +99,6 @@ GEM activemodel (= 3.0.3) activesupport (= 3.0.3) activesupport (3.0.3) - acts-as-taggable-on (2.0.6) addressable (2.2.2) arel (2.0.9) aws (2.3.32) @@ -190,6 +202,7 @@ GEM gem_plugin (0.2.3) gherkin (2.3.3) json (~> 1.4.6) + git (1.2.5) haml (3.0.25) hashie (0.4.0) highline (1.6.1) @@ -204,6 +217,10 @@ GEM jammit (0.5.4) closure-compiler (>= 0.1.0) yui-compressor (>= 0.9.1) + jeweler (1.5.2) + bundler (~> 1.0.0) + git (>= 1.2.5) + rake json (1.4.6) json_pure (1.5.1) launchy (0.4.0) @@ -232,6 +249,7 @@ GEM multi_json (0.0.5) multi_xml (0.2.1) multipart-post (1.1.0) + mysql (2.8.1) mysql2 (0.2.6) net-ldap (0.1.1) net-scp (1.0.4) @@ -282,6 +300,7 @@ GEM oa-enterprise (= 0.1.6) oa-oauth (= 0.1.6) oa-openid (= 0.1.6) + pg (0.10.1) polyglot (0.3.1) pyu-ruby-sasl (0.0.3.2) rack (1.2.1) @@ -355,6 +374,9 @@ GEM sinatra (1.2.0) rack (~> 1.1) tilt (< 2.0, >= 1.2.2) + sqlite3 (1.3.3) + sqlite3-ruby (1.3.3) + sqlite3 (>= 1.3.3) subexec (0.0.4) systemu (1.2.0) term-ansicolor (1.0.5) @@ -387,7 +409,7 @@ PLATFORMS DEPENDENCIES SystemTimer (= 1.2.1) - acts-as-taggable-on (= 2.0.6) + acts-as-taggable-on! addressable (= 2.2.2) aws (= 2.3.32) bundler (>= 1.0.0) diff --git a/db/migrate/20110311220249_downcase_tags.rb b/db/migrate/20110311220249_downcase_tags.rb new file mode 100644 index 0000000000000000000000000000000000000000..f25ce94140439677259a55c87b74a7706810ceee --- /dev/null +++ b/db/migrate/20110311220249_downcase_tags.rb @@ -0,0 +1,26 @@ +class DowncaseTags < ActiveRecord::Migration + def consolidate_tags_with_name(name) + tags = execute("SELECT * FROM tags WHERE tags.name = ?;", name) + keep_tag = tags.pop + tags.each do |bad_tag| + execute("UPDATE taggings + SET taggings.tag_id = #{keep_tag.first} + WHERE taggings.tag_id = #{bad_tag.first};") + execute("DELETE tags WHERE tags.id = #{bad_tag.first}") + end + end + def self.up + execute('UPDATE tags + SET tags.name = LOWER(tags.name);') + + names_with_duplicates = execute('SELECT name FROM tags + GROUP BY name + HAVING COUNT(*)>1;').to_a.flatten! + names_with_duplicates.each do |name| + consolidate_tags_with_name(name) + end unless names_with_duplicates.blank? + end + + def self.down + end +end diff --git a/db/schema.rb b/db/schema.rb index 5f818163d3f1c37bf32b6f72d2b10a43b85c70e6..5ef44075f6a361cd7cdf6542ad13804a6da2ced5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110311000150) do +ActiveRecord::Schema.define(:version => 20110311220249) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index 7be1cf4f7c32e4e7f318b1992a459818a3bb8566..0c49015529c6085968fec660255d9b82498a8669 100644 --- a/spec/models/status_message_spec.rb +++ b/spec/models/status_message_spec.rb @@ -180,7 +180,7 @@ STR end describe '#format_tags' do before do - @str = '#what #hey' + @str = '#what #hey' @sm.message = @str @sm.build_tags @sm.save @@ -192,7 +192,6 @@ STR end it 'responds to plain_text' do @sm.format_tags(@str, :plain_text => true).should == @str - end end describe '#build_tags' do diff --git a/spec/models/user/querying_spec.rb b/spec/models/user/querying_spec.rb index bce6037c459f0c64ef854b50d7ccd34b33f2a16f..59f88b89bc430d04b66b8219e99ba0c7a3fe7402 100644 --- a/spec/models/user/querying_spec.rb +++ b/spec/models/user/querying_spec.rb @@ -245,9 +245,9 @@ describe User do it 'displays recent posts first' do msg3 = @user3.post(:status_message, :message => "hey there", :to => 'all', :public => true) msg4 = @user3.post(:status_message, :message => "hey there", :to => 'all', :public => true) - msg3.updated_at = Time.now+10 + msg3.created_at = Time.now+10 msg3.save! - msg4.updated_at = Time.now+14 + msg4.created_at = Time.now+14 msg4.save! @user.posts_from(@user3.person).map{|p| p.id}.should == [msg4, msg3, @public_message].map{|p| p.id}