Use Array#uniq
with a block:
@photos = @photos.uniq { |p| p.album_id }
More Related Contents:
- How to determine if one array contains all elements of another array
- Boolean Validation
- Randomly output text from array to view – RAILS [closed]
- SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
- How do I get the current absolute URL in Ruby on Rails?
- SSL Error When installing rubygems, Unable to pull data from ‘https://rubygems.org/
- What is the easiest way to duplicate an activerecord record?
- redirect_to using POST in rails
- How to solve error “Missing `secret_key_base` for ‘production’ environment” (Rails 4.1)
- How can I avoid running ActiveRecord callbacks?
- ActiveRecord.find(array_of_ids), preserving order
- In Ruby on Rails, how do I format a date with the “th” suffix, as in, “Sun Oct 5th”?
- How does instance_eval work and why does DHH hate it?
- What’s the best way to use SOAP with Ruby?
- Rails: ActiveRecord query based on association value
- How can I find out the current route in Rails?
- Rails 4: assets not loading in production
- Using send_file to download a file from Amazon S3?
- How to use ActiveRecord in a ruby script outside Rails?
- Overriding a module method from a gem in Rails
- Controller spec unknown keyword: id
- Rails each loop insert tag every 6 items?
- Validation failed: Upload file has an extension that does not match its contents
- Ruby on Rails 3 howto make ‘OR’ condition
- Adding foreign key to a rails model
- Rails catch-all/globbing routes
- Always getting 401 Unauthorized with new install of Rails + Devise
- using has_many :through and build
- Why won’t Heroku accept my Gemfile.lock in Windows?
- Rails engines extending functionality