Skip to content

Instantly share code, notes, and snippets.

@Bodacious
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save Bodacious/aaf4f3cca89c8bb721fa to your computer and use it in GitHub Desktop.

Select an option

Save Bodacious/aaf4f3cca89c8bb721fa to your computer and use it in GitHub Desktop.
controller/views/intsance varialbes
# Bad:
class OrdersController
exposes :orders
def index
@orders = Order.complete
end
def pending
@orders = Order.pending
end
end
# Good:
class OrdersController
exposes :complete_orders, :pending_orders
def index
@complete_orders = Order.complete
end
def pending
@pending_orders = Order.pending
end
end
@cesc1989
Copy link

Is this rails 4 or 3?

What's the difference? In official guides they use the bad way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment