31 Dec '13, 10pm

Rendering Collections in Rails

Rendering Collections in Rails Joël Quenneville December 31, 2013 rails Partials are a great way to break down complex view into more manageable chunks as well as keeping view code DRY. However, rendering a partial for each item in a collection looks ugly: <% @user.comments.each do |comment| %> <%= render partial: 'comments/comment', locals: { comment: comment } %> <% end %> to_partial_path Luckily, Rails gives us this beautiful shorthand syntax: render @user.comments How does this magic work? Under the hood, render calls to_partial_path on each our objects to determine which partial to render. Models that inherit from ActiveRecord::Base will return a partial name based on the model's name by default. For example: User.new.to_partial_path # => 'users/user' You can override this: class User < ActiveRecord::Base def to_partial_path 'users/profile' end end POROs This works wi...

Full article: http://robots.thoughtbot.com/rendering-collections-in-rails

Tweets

Rendering Collections in Rails

rubyflow.com 07 Jan '14, 4am

Rendering Collections in Rails Posted by croaky on January 07, 2014 — 0 comments Partials are a great way to break down co...

Reading Rails - More Migrations

rubyflow.com 01 Jan '14, 3pm

Reading Rails - More Migrations Posted by netghost on January 01, 2014 — 0 comments You probably use ActiveRecord on a dai...

Buenísimo video para relaciones “has_and_belong...

railscasts.com 03 Jan '14, 6pm

It is often asked: how do I create a list of checkboxes for managing a HABTM association? Ask no more because this episode...

Using Polymorphism to Make a Better Activity Fe...

robots.thoughtbot.com 02 Jan '14, 9pm

Using Polymorphism to Make a Better Activity Feed in Rails Dan Croak December 02, 2013 rails You won't find "polymorphic p...

@hireDave found a better way - most of our apps...

pivotallabs.com 31 Dec '13, 4am

You might call this post Part 2 in a component based architecture series. The first post describes a solution for better o...

Understanding yield - #RoR #Rails #Layout #Rend...

guides.rubyonrails.org 09 Jan '14, 3pm

To find the current layout, Rails first looks for a file in app/views/layouts with the same base name as the controller. F...

Unable to find Ruby on Rails developers to hire in New York? We love working with NY clients. Get in touch!

Unable to find Ruby on Rails developers to hire...

planetargon.com 02 Jan '14, 6pm

Our team is always looking to help businesses and organizations succeed with their web projects. If you’re in New York and...

@r_0b3rt @PragTob @mpapis @plexus yeah I know. ...

guides.rubyonrails.org 30 Dec '13, 4pm

Active Record Basics Rails Database Migrations Active Record Validations Active Record Callbacks Active Record Association...

We still need a couple more sponsors to make @l...

larubyconf.com 09 Jan '14, 9pm

With out the continued support of the companies below the Los Angeles Ruby Conference would not be the quality it is today...

Handling large file uploads - Controllers & Vie...

railsforum.com 01 Jan '14, 11pm

I have a webapp that allows users to upload video files. These files vary in size, but some may be as large as 4GB. The pr...

TDD and ActiveRecord in Rails

rubyflow.com 06 Jan '14, 4pm

TDD and ActiveRecord in Rails Posted by solnic on January 06, 2014 — 0 comments Check out my thoughts on TDDing ActiveReco...

“Blog Padrino 0.12.0 - ActiveSupport 4, Rewritt...

padrinorb.com 02 Jan '14, 12am

Nearly 3 months have come and gone since the release of 0.11.4 and we are all very excited to announce the release of the ...

Community Collections: Chris Downes, M.D.

nicekicks.com 05 Jan '14, 6pm

checks in this week with a doctor from Kansas who uses his sneakers for a different kind of performance. Chris Downes is a...

RubyMine 6 for component-based Ruby and Rails applications

RubyMine 6 for component-based Ruby and Rails a...

pivotallabs.com 02 Jan '14, 10pm

I have previously written about how to use IntelliJ to set up multi-project support in RubyMine . I am happy to say that t...

Who wants to reboot the Rails Podcast? It's bee...

podcast.rubyonrails.org 02 Jan '14, 7pm

John Medina on Brain Rules for Baby, Part II Friday, October 15, 2010 Download: MP3 18.1 MB | MP4 27.2 MB Popular brain re...