Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Update for Membership to work in Ruby 1.9.2

 - note #!/usr/local/ruby19/bin/ruby -w 
 - is the path to my install of ruby 1.9, if you have ruby 1.9.2 installed in a different location, just update this to be #!/usr/bin/ruby or the path to your ruby install location.
  • Loading branch information...
commit 6d6afc38f0a3c283cf87a0a226a806819a458997 1 parent 24160a4
@newfront authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 rails_primer_code/Membership/Membership.rb
18 rails_primer_code/Membership/Membership.rb
@@ -1,13 +1,15 @@
-#!/usr/bin/ruby -w
+#!/usr/local/ruby19/binruby -w
# = Membership System
# Check to see if a Membership is expired
-require 'rubygems' #note. Ruby 1.9 includes rubygems by default, so this is not nessesary
+#require 'rubygems' #note. Ruby 1.9 includes rubygems by default, so this is not nessesary
+require 'rubygems'
require 'hashie'
+require 'time'
# parsedate will take a String and return a Time object
-require 'parsedate'
-include ParseDate
+#require 'parsedate'
+#include ParseDate
class Membership
@@ -28,8 +30,10 @@ def am_i_good?(user = nil)
last_real_payment = @@user.membership.payment_date
# Convert the Users last payment to a Time object from String
- last_payment_as_time = Time.local(*parsedate(last_real_payment))
+ # Time.parse(last_real_payment)
+ # Time.parse replaces parsedate in 1.9+
+ # last_payment_as_time = Time.local(*parsedate(last_real_payment)) #1.8.7 syntax
+ last_payment_as_time = Time.parse(last_real_payment)
#parse the date string and compare the current Time against the last payment made by the User
# if the users payment datetime plus the (subscription period) is greater than or equal to the current datetime
@@ -90,7 +94,7 @@ def super_class_subscription_period
#user.membership.payment_date = "Fri May 05 21:06:22 -0700 2010"
# Create a new Membership Object
-member =,60)
+member =,30)
# Reference a Class from within another Class
Please sign in to comment.
Something went wrong with that request. Please try again.