Tag Archives: Rails

Testing subdomain sites the easy way

You have two options to test sites that use multiple subdomains:

  1. Add each and every subdomain to your host file
  2. 127.0.0.1 site1.mywebapp.local
    127.0.0.1 site2.mywebapp.local
    etc.

  3. Setup a DNS server (Dnsmasq or Bind)

Both these approaches have their disadvantages. Updating your hosts file can become tedious, especially if your site supports dynamic subdomain creation. And setting up a DNS server takes some effort.

Tim Pope found a simple workaround for this problem. As he mentions here:

“I grabbed smackaho.st and made it a localhost wildcard, pointing *.smackaho.st at 127.0.0.1″

So that means you can now use URLs like http://site1.mywebapp.smackho.st or http://site2.mywebapp.smackho.st without having to add them to your hosts file.

One issue remains: say my development box is at 192.168.0.100 in my home network and my Droid is at 192.168.0.110, how would I be able to access the sites on my Droid? One way is to update the hosts file on the Droid, but you need root access for that.

So I grabbed dm7.me and made it point to my dev machine’s local ip address: *.dm7.me points to 192.168.0.100. Now I can access my development sites from all the devices on my network without having to update the hosts file on each and every one of them.


Using ActiveMerchant with Payflow Pro

Connection parameter’s for Payflow gateway:

  1. VENDOR => The merchant login ID that you created when you registered
  2. USER => User id of the user responsible for processing transactions (Usually same as the VENDOR unless you created additional users and assigned appropriate roles).
  3. PARTNER => From whom did you purchase your account? If from PayPal, then use the “PayPal”
  4. PWD => The password for the user mentioned in step (2)
gateway = ActiveMerchant::Billing::PayflowGateway.new(
  :user => 'user-name',        #USER
  :login => 'merchant-id',     #VENDOR
  :partner => 'partner-name',  #PARTNER
  :password => 'my-password'   #PWD
)

Follow

Get every new post delivered to your Inbox.