Archive

Archive for the ‘Ruby’ Category

Learn to build a Rails app using Heroku and Git

November 8th, 2009 admin No comments

Hi All:

I have recently discover Heroku service for building applications. It is extremely useful and extremely easy to use. It is also based in Git a SCM system which is also revolutionazing the version control systems.

To install Git, we could use this guide located on the progit or also you can see this page which explains how to use textmate with git

We set git configuration:

$ git config --global user.name "Your Name"
$ git config --global user.email youremail@example.com

There is a great Quickstart for using Heroku which I used as a base for this post: http://docs.heroku.com/quickstart

  • Sign in in Heroku
  • Install Heroku gem:
$ sudo gem install heroku
  • Create the local application in your mac: rails myapp
  • Access to the rails app: cd myapp
  • Install git
  • Execute git:  $ git init
  • Do git add:  $ git add .
  • We access to the following command:
    • Do git first commit: $ git commit -m "new app"
    • We open the application, and we start the local server ruby script/server and access to localserver using http://127.0.0.1:3000
    • As usual, we generate a index or home controller. I generally call them dashboard as it is sexy: $ ruby script/generate controller dashboard index
    • We delete the entry page: $ rm public/index.html
    • We modify the config/routes.rb to enter the following route map:
      • We create the heroku application directly on the heroku site from our computer merely using the Heroku’s gem
      • Now the web site will be visible on the following address: http://severe-stone-45.heroku.com. Sustitute the name by the name provided by Heroku and you got it. As the heroku repository is blank when we create the application we need to deploy the code to a specific branch, we deploy the code throuh this instruction
    • $ rake db:create
      db/development.sqlite3 already exists
      map.connect ':controller/:action/:id'
      map.connect ':controller/:action/:id.:format'
      # Enter the route to access to enter the dashboard
       map.root :controller => "dashboard"
      rake db:migrate
      heroku create
      Created http://severe-stone-45.heroku.com/ | git@heroku.com:severe-stone-45.git

      $ git push heroku master

    Categories: Ruby, RubyonRails Tags:

    I have changed to JQuery in Rails

    November 8th, 2009 admin No comments

    jQuery is today the best js library, prototype is a challenger.The reasons why I think this are beautifully illustrated on the following post. To use jQuery in rails install the following plugin:

    ruby script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails

    Here is a list of existing functions which are available once we replace prototype+scriptacuolous for the jquery. Hopefully, this support will improve once we approach to Rails 3.

    If you want to use both libraries, you will keep prototype js files, if you plan to use only jquery you could removed them. I particularly think that seems you have decided to use jquery there is few reasons to keep them.

    Also, there are two ways to use jquery, I just found this interesting article which speak about a different way to use jquery, not using jrails but instead in a more unobstrusive way. Interesting point of view.
    http://www.notgeeklycorrect.com/english/2009/05/18/beginners-guide-to-jquery-ruby-on-rails/

    Kind regards and good weekend

    Ruby on Windows Articles

    October 12th, 2008 admin 1 comment

    Hi All:

    Not very recently ago, I found this great site about how to automate our main and basic tasks on Windows using Ruby called Ruby on Windows

    . Being a lifetime ruby beginner, I found that maybe I could use this for my windows daily task and meanwhile learn a little bit more of Ruby.

    Apart from the Winsows Office articles (main objective of the research), I specially like the articles about wxruby as sometimes I feel in the need or creating my own GUI for some of the tasks I and doing. Since I have no interest in program with Visual Basic .Net, as I feel a huge industrial development environment is not suit for my specific need, I feel wxruby is suitable tool for me.

    Kind regards

    Categories: Ruby Tags: