Permalink
Browse files

Adding to_param to the models.

  • Loading branch information...
waratuman committed Sep 18, 2012
1 parent 4d4bc8a commit e7aaa4d6a3057abbe17eac66a8622e626051f8ca
Showing with 10 additions and 2 deletions.
  1. +4 −0 lib/mls/models/address.rb
  2. +4 −0 lib/mls/models/listing.rb
  3. +2 −2 test/test_helper.rb
@@ -52,6 +52,10 @@ def avatar(size='100x200', protocol='http')
"#{protocol}://maps.googleapis.com/maps/api/streetview?" + params.map{|k,v| k.to_s + '=' + URI.escape(v.to_s) }.join('&')
end
+ def to_param
+ [address.state, address.city, address.name].map(&:parameterize).join('/')
+ end
+
class << self
def query(q)
@@ -139,6 +139,10 @@ def to_hash
hash[:photo_ids] = photos.map(&:id) if photos
hash
end
+
+ def to_param
+ [address.state, address.city, address.name, id.to_s].map(&:parameterize).join('/')
+ end
def import #TODO test me
result = :failure
View
@@ -12,10 +12,10 @@
require 'fakeweb'
CACHE = {}
-MLS_HOST = 'http://localhost:4000/api'
+MLS_HOST = ENV['MLS_URL'] || 'http://localhost:4000/api'
FactoryGirl.find_definitions
-MLS.url = 'http://LBJXFC%2BhDiRRCYj6kXtXREfgNXRCJa8ALvPn%2FIeyjSe2QsQyHZ%2F%2BWwN2VZM2cw%3D%3D@localhost:4000'#ENV["MLS_TEST_URL"]
+MLS.url = ENV["MLS_TEST_URL"] || 'http://LBJXFC%2BhDiRRCYj6kXtXREfgNXRCJa8ALvPn%2FIeyjSe2QsQyHZ%2F%2BWwN2VZM2cw%3D%3D@localhost:4000'#
# MLS.auth_key = MLS::Account.authenticate('jonbracy@gmail.com', 'test').auth_key
# File 'lib/active_support/testing/declarative.rb', somewhere in rails....

0 comments on commit e7aaa4d

Please sign in to comment.