Thursday, May 15, 2014

Heroku app CNAME on Go Daddy


I'm Assuming:

  1.  you registered your domain at GoDaddy
  2. you have actual Heroku app that works on http://my_app.herokuapp.com
  3.  done everything correctly from https://devcenter.heroku.com/articles/custom-domains 
  4.  you have added your domain and www subdomain to heroku app like this:

$ ~/cd my_app
$ gem install heroku
$ heroku domains:add my_app.com
$ heroku domains:add www.my_app.com

now you want to point your GoDaddy  domain to your Heroku app with CNAME

1. login to goddady, and lunch your domain and click on "DNS Zone File" tab


2. Click "Add Record", Add CNAME, and point WWW to "my_app.heroku.com"


3. refering to http://support.godaddy.com/help/article/5289/updating-your-domain-names-ip-address-for-forwarding?locale=en&pc_split_value=3&countrysite=uk  you should point your A host  record  to  50.63.202.17

GoDaddy is changing design of their website too often, so if you cannot find these tabs, ...well, shit happens. Try to play around, they should be somewhere.

if you are looking for how to redirect / forward naked domain to www version directly from Go Daddy check this article: http://ruby-on-rails-eq8.blogspot.co.uk/2014/05/how-to-redirect-naked-domains-for.html




how to redirect naked domains for Heroku in Go Daddy

Assuming you already set your CNAME to point www on GoDaddy to your "http://my_app.herokuapp.com" (if not check this article: http://ruby-on-rails-eq8.blogspot.co.uk/2014/05/heroku-app-cname-on-go-daddy.html)

1. login to Go Daddy 

2. Lunch your domain

3. In Forwarding section click "Manage"


4. Redirect your naked domain to your "www.my_app.com" version  that is CNAME redirected to "my_app.herokuapp.com" (http redirect should be fine unless you want access to https version from naked domain;  use 301 so that Google will like you )




Friday, May 9, 2014

Make private method public in ruby




class Foo

  private

  def my_method
    'it work !'
  end
end
Foo.new.my_method
# => NoMethodError: private method `my_method' called for #<Foo:0x00000003ddb8e8>

Foo.send :public, :my_method
Foo.new.my_method
# => "it work !" 

class Bar < Foo
  public :my_method
end
Foo.new.my_method
# => NoMethodError: private method `my_method' called for #<Foo:0x00000003ddb8e8>

Bar.new.my_method
# => "it work !" 
source