Skip to content

Instantly share code, notes, and snippets.

🕴
up

Saad saadbinakhlaq

🕴
up
Block or report user

Report or block saadbinakhlaq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saadbinakhlaq
saadbinakhlaq / attachment.rb
Created May 21, 2016 — forked from madwork/attachment.rb
Polymorphic attachments with CarrierWave and nested_attributes
View attachment.rb
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment
View database.yml.example mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
You can’t perform that action at this time.