From afebeec821d21415497d61b8ba7fc7f9a3648c72 Mon Sep 17 00:00:00 2001 From: Daniel Kehoe Date: Tue, 26 Aug 2014 16:02:49 -0700 Subject: [PATCH] use ActiveModel instead of the activerecord-tableless gem --- CHANGELOG.textile | 5 ++-- Gemfile | 3 +-- Gemfile.lock | 62 +++++++++++++++++++++---------------------- app/models/contact.rb | 11 ++++---- app/models/visitor.rb | 6 ++--- 5 files changed, 42 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.textile b/CHANGELOG.textile index f865d930..b66713ac 100644 --- a/CHANGELOG.textile +++ b/CHANGELOG.textile @@ -1,9 +1,10 @@ h1. CHANGELOG -h3. 2.0.3 July 7, 2014 (book version unreleased) +h3. 2.1.0 unreleased (book version 2.1.0) * updated Ruby from version 2.1.1 to 2.1.2 -* updated Rails from version 4.1.1 to Rails 4.1.4 +* updated Rails from version 4.1.1 to Rails 4.1.5 +* use ActiveModel instead of the activerecord-tableless gem h3. 2.0.2 May 5, 2014 (book version 2.0.2) diff --git a/Gemfile b/Gemfile index 4dd0d365..ba6d2dad 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' ruby '2.1.2' -gem 'rails', '4.1.4' +gem 'rails', '4.1.5' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' @@ -9,7 +9,6 @@ gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'spring', group: :development -gem 'activerecord-tableless' gem 'foundation-rails' gem 'gibbon' gem 'google_drive' diff --git a/Gemfile.lock b/Gemfile.lock index a892465f..67cd56a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,38 +1,37 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) + actionmailer (4.1.5) + actionpack (= 4.1.5) + actionview (= 4.1.5) mail (~> 2.5.4) - actionpack (4.1.4) - actionview (= 4.1.4) - activesupport (= 4.1.4) + actionpack (4.1.5) + actionview (= 4.1.5) + activesupport (= 4.1.5) rack (~> 1.5.2) rack-test (~> 0.6.2) - actionview (4.1.4) - activesupport (= 4.1.4) + actionview (4.1.5) + activesupport (= 4.1.5) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.4) - activesupport (= 4.1.4) + activemodel (4.1.5) + activesupport (= 4.1.5) builder (~> 3.1) - activerecord (4.1.4) - activemodel (= 4.1.4) - activesupport (= 4.1.4) + activerecord (4.1.5) + activemodel (= 4.1.5) + activesupport (= 4.1.5) arel (~> 5.0.0) - activerecord-tableless (1.3.4) - activerecord (>= 2.3.0) - activesupport (4.1.4) + activesupport (4.1.5) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) arel (5.0.1.20140414130214) - better_errors (1.1.0) + better_errors (2.0.0) coderay (>= 1.0.0) erubis (>= 2.6.6) + rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) @@ -51,7 +50,7 @@ GEM execjs (2.2.1) faraday (0.9.0) multipart-post (>= 1.2, < 3) - foundation-rails (5.3.3.0) + foundation-rails (5.4.1.0) railties (>= 3.1.0) sass (>= 3.2.0) gibbon (1.1.3) @@ -100,15 +99,15 @@ GEM rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) - rails (4.1.4) - actionmailer (= 4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) - activemodel (= 4.1.4) - activerecord (= 4.1.4) - activesupport (= 4.1.4) + rails (4.1.5) + actionmailer (= 4.1.5) + actionpack (= 4.1.5) + actionview (= 4.1.5) + activemodel (= 4.1.5) + activerecord (= 4.1.5) + activesupport (= 4.1.5) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.4) + railties (= 4.1.5) sprockets-rails (~> 2.0) rails_12factor (0.0.2) rails_serve_static_assets @@ -116,9 +115,9 @@ GEM rails_layout (1.0.21) rails_serve_static_assets (0.0.2) rails_stdout_logging (0.0.3) - railties (4.1.4) - actionpack (= 4.1.4) - activesupport (= 4.1.4) + railties (4.1.5) + actionpack (= 4.1.5) + activesupport (= 4.1.5) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) @@ -157,7 +156,7 @@ GEM treetop (1.4.15) polyglot polyglot (>= 0.3.1) - turbolinks (2.2.2) + turbolinks (2.3.0) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) @@ -169,7 +168,6 @@ PLATFORMS ruby DEPENDENCIES - activerecord-tableless better_errors binding_of_caller coffee-rails (~> 4.0.0) @@ -181,7 +179,7 @@ DEPENDENCIES jquery-rails pg quiet_assets - rails (= 4.1.4) + rails (= 4.1.5) rails_12factor rails_layout sass-rails (~> 4.0.3) diff --git a/app/models/contact.rb b/app/models/contact.rb index 3199b2a4..8ab97d35 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,9 +1,8 @@ -class Contact < ActiveRecord::Base - has_no_table - - column :name, :string - column :email, :string - column :content, :string +class Contact + include ActiveModel::Model + attr_accessor :name, :string + attr_accessor :email, :string + attr_accessor :content, :string validates_presence_of :name validates_presence_of :email diff --git a/app/models/visitor.rb b/app/models/visitor.rb index 41058d94..5b1e1a2f 100644 --- a/app/models/visitor.rb +++ b/app/models/visitor.rb @@ -1,6 +1,6 @@ -class Visitor < ActiveRecord::Base - has_no_table - column :email, :string +class Visitor + include ActiveModel::Model + attr_accessor :email, :string validates_presence_of :email validates_format_of :email, :with => /\A[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}\z/i