April 8, 2015 by Daniel P. Clark

ActiveRecord vs Me… Round 1 – FIGHT!

I’ve done a fair bit of work in creating a library that integrates with ActiveRecord Objects.  I also have a pretty good grasp on mixins/inheritance.  Yet I still run into situations where trying include, extend, and techniques for monkey patching just don’t work out. I was trying to implement a method like first_or_create on the…

Continue Reading »

March 31, 2015 by Daniel P. Clark

Rails 4’s Awesome enums

In Rails 4 enum was introduced to support a feature that people were building by hand or by gem.  What enum does for you is it associates a symbol list for you to reference which will be stored in the database as an integer.  So :cow could be 0 and :dog could be 1 in…

Continue Reading »

March 15, 2015 by Daniel P. Clark

More UJS fun with Accordion Content

I’ve already covered loading Bootstrap modals directly from the server on Rails with UJS in this blog post: Discovering UJS with AJAX.  Now I’d like to continue from there and demonstrate Bootstrap’s accordion feature with content loaded directly from the server.  We’ll use a personal profile example where you click on an expansion link to…

Continue Reading »

March 9, 2015 by Daniel P. Clark

Ruby: Actionable Meta

The more you program the more likely you will need to change a string to the object the string represents. For example you may have a string with a mystery class name in it the you need to call methods on. Lets go a step further, lets say the method you need to call on…

Continue Reading »

February 24, 2015 by Daniel P. Clark

Writing methods for both class and instance levels

When perusing the Rails documentation for various methods I noticed something that seemed odd to me.  The method descriptions seemed to show an extra parameter as the first parameter that I was never using.  It’s strange when you use the methods all the time and it doesn’t seem to be implemented the way the documentation…

Continue Reading »

February 21, 2015 by Daniel P. Clark

Minitest with Watir-webdriver

Why, you might ask, would I even think of Watir-webdriver?  Well let me tell you.  It’s because it’s easy and fun.  It’s not a fast way to run tests though.  What Watir will do for you is open an actual web browser window and let you check and interact with it from your Ruby code….

Continue Reading »

February 20, 2015 by Daniel P. Clark

Some Basic Ruby Tools for Sniffing out Errors

Needing to know what’s going on under the hood is a big part to solving problems and challenges.  For the longest time I only ever used print statements to output to the console the state of something at a specific point.  That’s all I ever used in Python.  But sometimes you need to do a…

Continue Reading »

February 14, 2015 by Daniel P. Clark

Use the given project generators

Rails Before I started using Rails I was the guy who would type out web projects by hand… I was accustomed to it.  I knew what I was working with all the time simply because I wrote it.  When I had started reading the docs on Rails I was trying to learn it in this…

Continue Reading »

February 10, 2015 by Daniel P. Clark

Rails Polymorphic Associations

What is a polymorphic association you might ask?  It’s where an ActiveRecord model can potentially belong to more than one other kind of model record.  So the single instance of your car belongs to you, a person, whereas other cars may individually belong to a car lot, a business. Why do we need it? In…

Continue Reading »

February 7, 2015 by Daniel P. Clark

Do It All With Ruby

There is a recent post on thewildblogger.com titled “Top 12 Programming Languages for Beginners in 2015” which uses diagrams from IEEE Spectrum based on popularity of languages on the internet based on quantity.  The article itself does a decent job on touching on many good languages.  But I find the image graphic misleading. Image: IEEE…

Continue Reading »

Page 2 of 3
1 2 3
1 2 3