06 Oct '17, 1pm

Don’t use default_scope. Ever. https://t.co/E9GD2o61l7

Don’t use default_scope. Ever. When you would like a scope to be applied across all queries on a model, you can use default_scope . See more in the ActiveRecord Query Guide and Rails docs . Where you have a blog system with posts that can be set to be hidden, for when you are writing a draft. Instead of… …default_scope . # app/models/post.rb class Post < ActiveRecord :: Base default_scope { where ( hidden: false ) } end Use… …explicit scopes. # app/models/post.rb class Post < ActiveRecord :: Base scope , :published -> { where ( hidden: false ) } end …then you can do… Post . published But why? Two reasons. Both to do with avoiding later confusion and bug hunting. Adding a default scope affects your model initialization. In the example, Post.new is defaulted to hidden = false whether you are expecting it or not. Trying not to use your defined default scope is a pain. To remo...

Full article: https://andycroll.com/ruby/dont-use-default-scope/

Tweets

Yes the world has bigger issues...but your prob...

runtothefinish.com 05 Oct '17, 1pm

There are definitely days when I feel like I shouldn’t complain. I’ve always been a “keep your chin up” kind of person – y...

It’s time to stand out, don’t you think? #stepf...

famousfootwear.com 10 Oct '17, 11pm

Have you heard? Sneakers aren’t just for the gym anymore. Oh, no. Far from it, actually. These days, style is all about be...

Don’t Track Your Expenses or Budget First. Plot...

investmentmoats.com 07 Oct '17, 11pm

You do not need to budget or track your expenses. Instead, take 1 hour at the start of the month to compute your net worth...

Don’t ghost #Fox because you want to watch it o...

seriouslyomg.com 02 Oct '17, 2am

[ # ] Don’t ghost Fox because you want to watch it on Sundays! October 1st, 2017 under Fox , The Simpsons , Will Forte Gam...

@Cointelegraph

@Cointelegraph

cointelegraph.com 09 Oct '17, 10pm

There’s been some panic lately over the various “forks” of the Bitcoin network, particularly among the less tech-savvy who...

First ever video footage of wild sand cat kitte...

inhabitat.com 12 Oct '17, 12pm

Sand cats haven’t been well studied in their natural range, according to Breton. After the sightings, the team acquired a ...

Woods: ‘I don’t know what my future holds for m...

pgatour.com 27 Sep '17, 9pm

JERSEY CITY, N.J. – Tiger Woods, an assistant to U.S. Captain Steve Stricker at this week’s Presidents Cup at Liberty Nati...

Find out what goes on behind the scenes in the ...

nlb.gov.sg 06 Oct '17, 4am

Find out what goes on behind the scenes in the funeral industry! Angjolie Mei has been in the funeral business for over 10...

For the first time ever, a black model opened t...

metro.co.uk 06 Oct '17, 12pm

(Picture: Peter White/Getty Images) A black woman walking the runway at Louis Vuitton shouldn’t be a big deal. It should b...

For the first time ever, a black model opened t...

metro.co.uk 06 Oct '17, 9am

(Picture: Peter White/Getty Images) A black woman walking the runway at Louis Vuitton shouldn’t be a big deal. It should b...

Hi Gilbert, I’ m at my wit’s end. I need your advice on what to do. I don’t have anyone to turn to for help. I”m... https://t.co/HHIL8VuBsa

Hi Gilbert, I’ m at my wit’s end. I need your a...

transitioning.org 10 Oct '17, 9am

I’ m at my wit’s end. I need your advice on what to do. I don’t have anyone to turn to for help. I”m Ali, age 41 the only ...

First-ever population estimate of the mysterious marbled cat from continental Asia revealed

First-ever population estimate of the mysteriou...

news.mongabay.com 06 Oct '17, 10am

For the first time, scientists have estimated the density of the marbled cat in continental Asia. The researchers also est...

What To Expect At The First Ever #MonacoFilmFestival In #Singapore

What To Expect At The First Ever #MonacoFilmFes...

stylexstyle.com 09 Oct '17, 10pm

The Monaco Government Tourist and Convention Authority will be hosting the Monaco Film Festival this October in Singapore ...

College Golf Search: Don't count out @NCAA Divi...

golfwrx.com 07 Oct '17, 3pm

The absence of athletic scholarships from DIII schools is what sets it apart the most from DI and DII. Because of this, Di...

Schlechtestes Argument ever!

gestern-nacht-im-taxi.de 11 Oct '17, 3am

Ein sehr ungleiches Paar. Er vielleicht Mitte 40, ruhig und gelassen, sie dagegen eher 30 und aufbrausend. Sie hatten eine...