Category Archives: Ruby

Leveraging the Ruby language for code readability

Recently, I created a rake task to load dummy data into a Rails app. I wanted the data to be somewhat random to make it easier to spot design issues depending on data being filled in or left blank. But … Continue reading

Posted in Ruby | Comments Off on Leveraging the Ruby language for code readability

Automating web site interactions with Selenium

Dannon currently has a “promotion” called Cups of Hope where you can enter codes into their web page to donate money to breast cancer research. Entering data repeatedly gets old real fast, so I figured this would be a great … Continue reading

Posted in Automation, Ruby | Comments Off on Automating web site interactions with Selenium

Selecting an option from dropdown form fields with Mechanize

Mechanize works great for uploading data through forms: it has great support for manipulating text fields, check boxes, and so on. Selecting the appropriate option from a dropdown is slightly more roundabout.

Posted in Automation, Mechanize, Ruby | Comments Off on Selecting an option from dropdown form fields with Mechanize

Uploading data using Mechanize

In this post, I’ll briefly describe a Mechanize script I wrote to update data in a web application. We’ll see how to navigate using Mechanize, and finding HTML elements with XPath. The goal was simple: open a CSV file containing … Continue reading

Posted in Automation, Mechanize, Ruby | Comments Off on Uploading data using Mechanize

Initializing the test database before a Cucumber session (in Rails)

In one of my side projects, I needed some setup data to be present in the test database before each Cucumber session. Since this took me a few moments to get right, I figured I’d document it here.

Posted in Rails, Ruby | 4 Comments

Leveraging Active Record reflections

I recently ran into an issue using the permanent records gem: when you permanently destroy a record (i.e. NOT soft delete), the dependent records with a `:dependent => :destroy` relationship are only soft deleted (i.e. marked as deleted, but kept … Continue reading

Posted in Rails, Ruby | Comments Off on Leveraging Active Record reflections

Data wrangling and Ruby metaprogramming

I needed to combine customer data from 2 separate sources (a homebrew warehouse and CRM) and output a report. Given I’d be dealing with similar objects with overlapping attributes, it would be really easy to make a gigantic mess with … Continue reading

Posted in Automation, Ruby, SugarCRM Ruby gem | Comments Off on Data wrangling and Ruby metaprogramming

Adding a namespaced Rails generator to a standalone Ruby gem

I wanted to add a generator to the SugarCRM ruby gem, but couldn’t find any straightforward resources on doing just that: taking a standalone ruby gem, and adding a generator that is available from within a Rails environment. To make matters … Continue reading

Posted in Rails, Ruby, SugarCRM Ruby gem | 2 Comments

Ruby Gem for SugarCRM: Advanced use

This is an article about “advanced” use of the SugarCRM Ruby gem. We’ve previously covered using basic gem functionality, and building a simple rails app using the gem to make a CRM portal, so you might want to take a … Continue reading

Posted in CRM, Ruby, SugarCRM Ruby gem | Comments Off on Ruby Gem for SugarCRM: Advanced use

Ruby Gem for SugarCRM: Ruby on Rails Integration

Having gone over the basics in a previous article, we will now cover how you can get a basic Rails 3 app (using the SugarCRM Ruby gem) up and running. (The SugarCRM Ruby gem relies on ActiveSupport >= 3, and … Continue reading

Posted in CRM, Rails, Ruby, SugarCRM Ruby gem | 4 Comments