Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)
- Some utilities:
sudo apt-get install vim tmux git curl
- Copy/paste from the command line:
class Attachment < ActiveRecord::Base | |
mount_uploader :attachment, AttachmentUploader | |
# Associations | |
belongs_to :attached_item, polymorphic: true | |
# Validations | |
validates_presence_of :attachment |
sudo apt-get install vim tmux git curl
:ruby | |
config = field.associated_model_config | |
selected = field.bindings[:object].send(field.association[:name]) | |
selected_ids = selected.map(&:id) | |
xhr = field.associated_collection_count > 100 | |
if xhr | |
collection = selected.map do |o| | |
[o.send(config.object_label_method), o.id] | |
end | |
else |