Skip to content

Instantly share code, notes, and snippets.

@Jaffery5
Jaffery5 / User.rb
Last active August 29, 2015 14:06
Query emails of all users who has a profile
class User < ActiveRecord::Base
attr_accessible :email, :password, :password_confirmation,:first_name, :last_name
has_one :profile
end
@Jaffery5
Jaffery5 / new.html.erb
Created July 9, 2014 22:34
Colorbox plugin
<h1>Photos</h1>
<% if @profile.portfolios.count >= 1 %>
<div id="nanoGallery">
<% @profile.portfolios.each do |user| %>
<%=link_to image_tag(user.image.url), user.image.url %>
<% end %>
</div>
<% end %>
@Jaffery5
Jaffery5 / error
Last active August 29, 2015 14:03
Paperclip::AdapterRegistry::NoHandlerError
No handler found for [#<ActionDispatch::Http::UploadedFile:0x007f8b60310158 @tempfile=#<Tempfile:/var/folders/h_/n3tkl5j51zq8_0fx987g4pqr0000gn/T/RackMultipart20140630-14626-suf62t>, @original_filename="door.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"images[]\"; filename=\"door.jpg\"\r\nContent-Type: image/jpeg\r\n">]
@Jaffery5
Jaffery5 / Controller
Created August 8, 2013 02:24
Open tok code... Really need some help
class RoomsController < ApplicationController
before_filter :config_opentok,:except => [:index]
def index
@rooms = Room.where(:public => true).order("created_at DESC")
@new_room = Room.new
end
def create
session_properties = {OpenTok::SessionPropertyConstants::P2P_PREFERENCE => "enabled"}