<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Playgroundrus on Yang's Blog</title><link>https://blog.yangtheman.com/tags/playgroundrus/</link><description>Recent content in Playgroundrus on Yang's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2026 Yang Chung</copyright><lastBuildDate>Sat, 05 Sep 2009 08:57:21 +0000</lastBuildDate><atom:link href="https://blog.yangtheman.com/tags/playgroundrus/index.xml" rel="self" type="application/rss+xml"/><item><title>Deploying a Rails app on Heroku (paperclip, gems, yml)</title><link>https://blog.yangtheman.com/2009/09/05/deploying-a-rails-app-on-heroku-paperclip-gems-yml/</link><pubDate>Sat, 05 Sep 2009 08:57:21 +0000</pubDate><guid>https://blog.yangtheman.com/2009/09/05/deploying-a-rails-app-on-heroku-paperclip-gems-yml/</guid><description>&lt;p&gt;I just moved my &lt;a href="http://www.playgroundrus.com" target="_blank" rel="noreferrer"&gt;PlaygroundsRUs&lt;/a&gt; site from &lt;a href="http://aws.amazon.com/ec2/" target="_blank" rel="noreferrer"&gt;AWS&lt;/a&gt; to &lt;a href="http://heroku.com/" target="_blank" rel="noreferrer"&gt;Heroku&lt;/a&gt;, and I couldn&amp;rsquo;t be happier. My first full month bill from Amazon was about $75, and $74 of that (99% of the total cost) was for running an instance. &lt;a href="http://www.harlanknight.net/pub/H@rlan_Knight_Wood/" target="_blank" rel="noreferrer"&gt;Harlan&lt;/a&gt; told me about Heroku after he deployed his &lt;a href="http://fork-this-demo.heroku.com/login" target="_blank" rel="noreferrer"&gt;ForkThis&lt;/a&gt; demo on there.&lt;/p&gt;
&lt;p&gt;Most of the transition was smooth, but there were a few hiccups on the way. One of them still hasn&amp;rsquo;t been resolved (one of the plugins is having conflict with PostgresSQL, which is used by Heroku). I will enumerate what I had to go through so that it might be easier for you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Secret YAML files&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I have a public GitHub account for deploying on AWS using &lt;a href="http://ec2onrails.rubyforge.org/" target="_blank" rel="noreferrer"&gt;ec2onrails&lt;/a&gt;. Since it&amp;rsquo;s public and anyone can see it, I had to omit sensitive &lt;code&gt;.yml&lt;/code&gt; files in config directory that contained passwords and keys. It&amp;rsquo;s easily done by specifying those files in &lt;code&gt;.gitignore&lt;/code&gt; and listing them in &lt;code&gt;:nonvc_configs&lt;/code&gt; in &lt;code&gt;config/deploy.rb&lt;/code&gt; used by ec2onrails.&lt;/p&gt;
&lt;p&gt;I found out that for Heroku, the same can be achieved by creating another branch, including those files, merging with master, and pushing it to Heroku. So, the following lines should do the trick.&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git checkout production
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[remove those yml files from .gitignore]
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git merge master
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push heroku production:master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;**&lt;/p&gt;</description></item><item><title>How to integrate Google Maps in a Rails app</title><link>https://blog.yangtheman.com/2009/08/27/how-to-integrate-google-maps-in-a-rails-app/</link><pubDate>Thu, 27 Aug 2009 20:08:28 +0000</pubDate><guid>https://blog.yangtheman.com/2009/08/27/how-to-integrate-google-maps-in-a-rails-app/</guid><description>&lt;p&gt;The major part of my experiment was going to be the integration with Google Maps. At first, I was a bit apprehensive about it, but Ruby on Rails being a community oriented language, I found a couple of quite useful plug-ins. With them, finding a location based on address or geocode or finding nearby places based on certain radius of a location were not too hard.&lt;/p&gt;
&lt;p&gt;There is actually an excellent book also, called &lt;a href="http://books.google.com/books?id=E90Dg0N-FQkC&amp;amp;dq=google&amp;#43;maps&amp;#43;rails&amp;amp;source=gbs_navlinks_s" target="_blank" rel="noreferrer"&gt;Beginning Google maps applications with Rails and Ajax&lt;/a&gt;. But the problem with the book is that it was geared towards more for java developers using rails. Thus, its major functions were javascripts and it showed how to talk to rails app. In my case, since I wanted simple features and I didn&amp;rsquo;t want to take time to learn javascript, I decided to find a simpler way.&lt;/p&gt;
&lt;p&gt;And I found that for things I wanted to do, I could do with &lt;a href="http://ym4r.rubyforge.org/ym4r_gm-doc/" target="_blank" rel="noreferrer"&gt;YM4R/GM&lt;/a&gt; and &lt;a href="http://geokit.rubyforge.org/" target="_blank" rel="noreferrer"&gt;Geokit&lt;/a&gt;. There are other excellent tutorials out there like the &lt;a href="http://www.developer.com/open/article.php/3757576" target="_blank" rel="noreferrer"&gt;one&lt;/a&gt; by Jason Gilmore on Developer.com.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s begin.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Sign-up for Google Maps API by going to &lt;a href="http://code.google.com/apis/maps/signup.html" target="_blank" rel="noreferrer"&gt;here&lt;/a&gt;. For development environment, you can use either http://localhost:3000 or http://127.0.0.1:300 as the website URL. Copy the API key.&lt;/p&gt;
&lt;p&gt;When you move to production environment, make sure you come back here to get another key for production URL.&lt;/p&gt;</description></item><item><title>Singleton Class, acts_as_rated and twitterify in Rails</title><link>https://blog.yangtheman.com/2009/08/27/singleton-class-acts_as_rated-and-twitterify-in-rails/</link><pubDate>Thu, 27 Aug 2009 17:14:06 +0000</pubDate><guid>https://blog.yangtheman.com/2009/08/27/singleton-class-acts_as_rated-and-twitterify-in-rails/</guid><description>&lt;p&gt;Today, I went to &lt;a href="http://ruby.meetup.com/117/" target="_blank" rel="noreferrer"&gt;San Jose Ruby Hackfest meetup&lt;/a&gt;, and met a bunch of cool guys. One of them was &lt;a href="http://blog.angelbob.com/posts" target="_blank" rel="noreferrer"&gt;Noah Gibbs&lt;/a&gt;, who helped me tremendously with one of the most pesky problems I had.&lt;/p&gt;
&lt;p&gt;Before you go on, you might want to read up on really good tutorials on &lt;a href="http://jonesbunch.com/articles/2008/ruby-singleton" target="_blank" rel="noreferrer"&gt;Singleton Class&lt;/a&gt; and &lt;a href="http://blog.angelbob.com/posts/20" target="_blank" rel="noreferrer"&gt;Self variable&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>How to integrate Facebook Connect with a Rails app</title><link>https://blog.yangtheman.com/2009/08/23/how-to-integrate-facebook-connect-with-a-rails-app/</link><pubDate>Mon, 24 Aug 2009 05:36:59 +0000</pubDate><guid>https://blog.yangtheman.com/2009/08/23/how-to-integrate-facebook-connect-with-a-rails-app/</guid><description>&lt;p&gt;&lt;em&gt;Update: I have written up another post for using Devise and Omniauth, and you can find it &lt;a href="http://blog.yangtheman.com/2012/02/09/facebook-connect-with-rails-omniauth-devise/" target="_blank" rel="noreferrer"&gt;here&lt;/a&gt;. Facebooker is no longer maintained.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Top of my to-do list was to integrate Facebook Connect with my Rails app, since 1) there are A LOT of people using Facebook and 2) having to register to post or edit could be an obstacle in getting more users to use my site.&lt;/p&gt;
&lt;p&gt;I looked on the web for a while, and found a great example by Stuart Eccles at &lt;a href="http://www.madebymany.co.uk/tutorial-for-restful_authentication-on-rails-with-facebook-connect-in-15-minutes-00523" target="_blank" rel="noreferrer"&gt;Made by Many&lt;/a&gt;. It&amp;rsquo;s an awesome tutorial, but it&amp;rsquo;s for restful_authentication. I don&amp;rsquo;t use it, so I had to modify it a little bit. Also, I added a step to ask a user to pick a username. So the following instruction is basically modification of Stuart&amp;rsquo;s.&lt;/p&gt;
&lt;p&gt;Without further ado, let&amp;rsquo;s begin.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Setup Facebook Application page&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.1.&lt;/strong&gt; Go to this &lt;a href="http://www.facebook.com/developers/#/developers/createapp.php" target="_blank" rel="noreferrer"&gt;page&lt;/a&gt;, and enter a name for your application. I named mine &amp;ldquo;Playgrounds_R_Us&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.2.&lt;/strong&gt; Make a note of &lt;strong&gt;Application ID&lt;/strong&gt;, &lt;strong&gt;API Key&lt;/strong&gt;, and &lt;strong&gt;Secret&lt;/strong&gt;. You need it for &lt;strong&gt;facebooker.yml&lt;/strong&gt; later.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.3.&lt;/strong&gt; Next is &lt;strong&gt;Authentication&lt;/strong&gt; section. Here what&amp;rsquo;s important is &lt;strong&gt;Post-Authroize&lt;/strong&gt; and &lt;strong&gt;Post-Remove Callback URL&lt;/strong&gt;. They refer to a web page a user will be taken to after logging into and logging out of Facebook account. While testing, I left it at &amp;ldquo;http://127.0.0.1:3000&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.4.&lt;/strong&gt; I also used the same URL (http://127.0.0.1:3000) for &lt;strong&gt;Canvas Callback URL&lt;/strong&gt; in &lt;strong&gt;Canvas&lt;/strong&gt; section and &lt;strong&gt;Connect URL&lt;/strong&gt; in &lt;strong&gt;Connect&lt;/strong&gt; section.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.5.&lt;/strong&gt; Then you are pretty much set with configuration on Facebook side.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Get &lt;a href="http://github.com/mmangino/facebooker/tree/master" target="_blank" rel="noreferrer"&gt;facebooker&lt;/a&gt; plugin and install it. From your rails app root directory,&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ruby script/plugin install git://github.com/mmangino/facebooker.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</description></item><item><title>Driving direction and link to edit playground information</title><link>https://blog.yangtheman.com/2009/08/11/driving-direction-and-edit-playground-link/</link><pubDate>Tue, 11 Aug 2009 07:57:05 +0000</pubDate><guid>https://blog.yangtheman.com/2009/08/11/driving-direction-and-edit-playground-link/</guid><description/></item></channel></rss>