Leave a comment

Exploring Rails: Single Table Inheritance

As usual a great article by Ramon!!

Project Ramon

Hello and happy Wednesday!

In the last post, we covered a solution towards using the Rails’ Form Helper accepts_nested_attributes_for to give us a convenient ability to create data fields for multiple models to save and retrieve. This is also known as creating a multi-part form.

At the time I hadn’t figured out how to implement Single Table Inheritance properly, and instead created 2 phone number classes to represent a primary and secondary number. After some quick looking around, I found some pretty insightful tutorials that allowed me to use STI in order to DRY out my two redundant classes from the last post.

What I did Wrong

Lets take a quick look at the code from my last post, in order to demonstrate the problem and set the stage for implementing STI properly in Rails.

I was having an issue with seeing the attribute fields commit or retrieve the…

View original post 670 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: