The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
That about sums it up

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Obie Fernandez

Posts: 608
Nickname: obie
Registered: Aug, 2005

Obie Fernandez is a Technologist for ThoughtWorks
That about sums it up Posted: Oct 18, 2006 10:43 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Obie Fernandez.
Original Post: That about sums it up
Feed Title: Obie On Rails (Has It Been 9 Years Already?)
Feed URL: http://jroller.com/obie/feed/entries/rss
Feed Description: Obie Fernandez talks about life as a technologist, mostly as ramblings about software development and consulting. Nowadays it's pretty much all about Ruby and Ruby on Rails.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Obie Fernandez
Latest Posts From Obie On Rails (Has It Been 9 Years Already?)

Advertisement

Concerning the coming deprecation of much-maligned with_scope, David summed up what it's all about on the Rails core mailing list. Check this out:

> I think it's a poor choice to limit something that people find useful just
> because it doesn't fit your idea of useful. Why not let the coder make these
> decisions?

You must be new here :). Rails is opinionated software. We make things that we consider good style easy to do and bad style hard. Or rather, we make good style beautiful and bad style ugly. So even though with_scope is going protected, you can still use it in filters if you really, really want to. Just use send(:with_scope) -- that'll side-step the access control. Yes, that'll be ugly and it's intended to be.

Using around_filters in the manor you describe makes it really hard to figure out what's going on from looking at the action in isolation. It looks like you're doing a straight, in-secure find to the naked eye. And there's no bread crumbs for others to follow that'll leave them to your around_filter. It's a recipe for hard-to-read code. And it shields the reader from understand your model hierarchy.

In summary, Rails will shake its head at you for using with_scope in filters, but will ultimately leave it at your discretion to choose the right path. We believe in encouragement and discouragement, not allowing or forbidding.

Read: That about sums it up

Topic: Proyecto de Traducci��n de la Documentaci��n de Java al Espa��ol Previous Topic   Next Topic Topic: I'm Building Something Remarkable

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use