Skip to content

Instantly share code, notes, and snippets.

View Dacello's full-sized avatar
🧙

Daniel Andrews Dacello

🧙
View GitHub Profile
@Dacello
Dacello / keybase.md
Created January 3, 2019 16:32
Keybase

Keybase proof

I hereby claim:

  • I am dacello on github.
  • I am dacello (https://keybase.io/dacello) on keybase.
  • I have a public key ASBoXi7AXYp5X2mSz2TDRkkaaBwoj6vRS7kuZUy1-jlx_go

To claim this, I am signing this object:

def fix_appointments_missing_timeslots
appts = Appointment.joins(time_block: [:time_slot]})
.upcoming
.where(organization_id: @org.id, status: [0,1,2])
.where(time_blocks: [time_slot: [deleted_at: nil]])
ts_ids = appts.pluck('time_slots.id')
tb_ids = appts.pluck('time_blocks.id')
end
layout author title
post
daniel andrews
Skinny Everything (Part 2 of 3)

The first article in this series brought up the following fact about MVC frameworks: while it is very important to have a skinny controller, it is much better to have a skinny everything. If you didnt read the previous article, know that I am talking about Rails specifically, but this concept applies to MVC in general.

The first method I wrote about was using Draper for Decorators, which is a nice way to keep display logic out of models without resorting to using helpers. This article will cover another method for getting skinnier:

@Dacello
Dacello / gist:b2bb6223ca1884d0885e
Last active August 29, 2015 14:06
Skinny Everything Blog Post Draft

#Skinny Everything (Part 1 of 3)

At Revelry, we build web apps using Rails. Working with Rails, or any MVC/MVP framework for that matter, you will come across the saying "Fat model, Skinny Controller". The idea is to slim the the controller down to basic CRUD actions, and put the rest of the more complex functionality in the model. It definitely is good to have a slim controller for sake of code reusability, readability, and testing. However, it is also good to have a skinny model. For the exact same reasons. In fact, its just good to have a skinny everything.

What tends to happen when you move all logic into models is that you get "God like Models" which become impossible to understand and maintain. Jon Cairns also wrote a great article about why "Fat model, Skinny Controller is a load of rubbish."

Unfortunat

#Skinny Everything (1 of 3)
At Revelry, we build web apps using Rails. Working with Rails, or any MVC/MVP framework for that matter, you always come across the saying "Fat model, Skinny Controller". The idea is to slim the the controller down to basic CRUD actions, and put the rest of the more complex functionality in the model. It definitely is good to have a slim controller for sake of code reusability, readability, and testing. However, it is also good to have a skinny model. For the exact same reasons. In fact its good to have a skinny everything.
What tends to happen when you move all logic into models is that you get "God like Models" which [become impossible to understand and maintain](http://stackoverflow.com/questions/14044681/fat-models-and-skinny-controllers-sounds-like-creating-god-models). Jon Cairns wrote a great article about why ["Fat model, Skinny Controller is a load of rubbish"](http://blog.joncairns.com/2013/04/fat-model-skinny-controller-is-a-load-of-rubbish/). Cairns says:
```
No clas

#Skinny Everything (1 of 3)

At Revelry, we build web apps using Rails. Working with Rails, or any MVC/MVP framework for that matter, you always come across the saying “Fat model, Skinny Controller.� The idea is to slim the the controller down to basic CRUD actions, and put the rest of the more complex functionality in the model. It definitely is good to have a slim controller for sake of code reusability, readability, and testing. However, it is also good to have a skinny model. For the exact same reasons. In fact its good to have a skinny everything.

What tends to happen when you move all logic into models is that you get “God like Models� which become impossible to understand and maintain. Jon Cairns wrote a great article about why [“Fat model, Skinny Controller is a load of rubbish�](http://blog.joncairns.com/2013/04/fat-model-skinny-controller-is-a-load-of-

#Skinny Everything (1 of 3)

At Revelry, we build web apps using Rails. Working with Rails, or any MVC/MVP framework for that matter, you always come across the saying “Fat model, Skinny Controller.” The idea is to slim the the controller down to basic CRUD actions, and put the rest of the more complex functionality in the model. It definitely is good to have a slim controller for sake of code reusability, readability, and testing. However, it is also good to have a skinny model. For the exact same reasons. In fact its good to have a skinny everything.

What tends to happen when you move all logic into models is that you get “God like Models” which become impossible to understand and maintain http://stackoverflow.com/questions/14044681/fat-models-and-skinny-controllers-sounds-like-creating-god-models. Jon Cairns wrote a great article about why “Fat model, Skinny Controller is a load of rubbish” http://blog.joncairns.com/2013/04/fat-model-skinny-controller-is-a-load-of-rubbish/. Cairns says

“No class should b