What you plant now, you will harvest later

Its not that i don’t agree with the American author Og Mandino(the guy that wrote the quote in the title), its just that i think its better to let others plant it for you so you could harvest it now.

What the hell am i talking about ? well… Ruby on rails…

After a long time as a .Net (invented by a small company: Microsoft) programmer i decided to switch to ruby. I have to admit that it wasn’t an easy start since they are so different. With Microsoft you get all the “equipment” you need like Visual studio, Sql managment studio, Expression studio and many more high tech tools. Going from that to Notepad was kinda wired. With all that i decided i’am not giving up, and let me tell you what i found to be the benefits:

  • You have some nice IDEs for Ruby. after going through most of them i have to say that Ruby-Mine is my favorite by far since you could use it on all platforms. A free text editor which is also nice is sublime-text. After getting used to it, its not all that bad.
  • Let me go back to the title of the post. The open source community is HUGE ! you could find almost anything you want on github. Most of the gems are written very well and have a lot of support from the open source community. You could have a first working draft of your site in a few days without doing nothing but installing gems, and after learning a bit you could change and redesign anything you want – ITS ALL OPEN SOURCE.
  • Something i have learned is that ruby is also Aspect-Oriented and it keeps your code DRY(don’t repeat yourself) by making you write code the “ruby way”.
  • Another big advantage is the ruby “convention over configuration“. What does it mean? Well.. its not just a buzz word. The thing is that most of the functionality is already built in the framework and unless you want to go another way its all there. Want an example? well.. lets say you want to make a REST API for your application, all you have to do is create the controllers and make 1 change in the routes.rb file and your done!
  • And many more…

For conclusion i would like to say that Ruby on rails is a really good way to go if you decided to build a new website from scratch. It may take some time to get used to it at first but it will cover your lost time very fast with the help of the community.

Let me just add one more thing about the start of the post. I know i said you should let the others do all the work (the planting stuff). That is just until you get the hang of rails so you could give back to the same community that helped “raising you”.

Thanks.

Paypal, ActiveMerchant, Rails, Integration, Items, Error

If you’re stuck trying to add items, or having trouble understanding why your paypal transaction isn’t working (probably in sandbox) let me give you the tip that saved my sanity. Are you ready?

YOU HAVE TO MAKE SURE THE PRICE OF YOUR ITEMS ADD UP TO THE TOTAL YOU SPECIFIED!

If you’re using Rails and ActiveMerchant, you’ve probably done something like this:


response = EXPRESS_GATEWAY.setup_purchase(1500,
:items => [
{
:name => "Tickets",
:description => "best in show",
:amount => 300,
:quantity => 1,
},
{
:name => "More Tickets",
:description => "best in show too",
:amount => 500,
:quantity => 2,
},

],
:ip => request.remote_ip,
:return_url => “http://www.wow.com”,
:cancel_return_url => “http://www.shit.com”,
)

The above code will produce an error because the total amount specified at the top is 1500, while the sum of the ‘amount’ fields of the items is 1300 ((300 x 1) + (500 x 2)). Hope this helps.