Skip to content

Instantly share code, notes, and snippets.

View karmiclychee's full-sized avatar

Jayml Mistry karmiclychee

  • Seattle, WA
View GitHub Profile
class Profile < ActiveRecord::Base
belongs_to :user
has_many :collections
attr_accessible :avatar, :name, :title, :description
validates :name, presence: true, length: { minimum: 1, maximum: 60 }
validates :description, presence: true, length: { minimum: 1, maximum: 60 }
validates :title, presence: true, length: { minimum: 1, maximum: 60 }
class Project < ActiveRecord::Base
belongs_to :collection
has_many :items
attr_accessible :name, :description, :links
attr_accessor :image
serialize :links
validates :name, uniqueness: { scope: :collection_id }, length: {minimum: 1, maximum: 20}, allow_blank: false
class Collection < ActiveRecord::Base
belongs_to :profile
has_many :projects
has_one :thumbnail, class_name: "item", as: :thumbnailable
attr_accessible :name, :description
attr_accessor :image
validates :name, uniqueness: { scope: :profile_id }, length: { minimum: 1, maximum: 100 }, allow_blank: false
validates :description, length: { minimum: 5, maximum: 1000 }, allow_blank: true
1) Creating Items User can create an item
Failure/Error: click_button "Create Item"
Capybara::ElementNotFound:
Unable to find id 1
# ./app/controllers/items_controller.rb:55:in `find_collection'
# ./spec/integration/item_create_spec.rb:22:in `block (2 levels) in <top (required)>'
!!!
%html
%head
%title Flip
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
%body
.container
.row
@karmiclychee
karmiclychee / gallery.html.haml
Created April 29, 2013 21:24
re: gal_background local variable. If the gallery item has an image attached, then it's the gal_background, otherwise, it's the placeholder image. Currently, gal_background is set, and the gallery iterator uses it to define "style: background-image: url(?)"
@karmiclychee
karmiclychee / gist:5500596
Last active December 16, 2015 21:29
Compare line 60 to the error on line 80.
% heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.3374
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
Connecting to database specified by DATABASE_URL
Migrating to DeviseCreateUsers (20130
[15] pry(main)> Site
=> Site(Table doesn't exist)
[16] pry(main)> ActiveRecord::Base.connection.tables
=> ["schema_migrations", "site"]
Error:
PG::Error: ERROR: relation "sites" does not exist
require 'tweetstream'
require 'pry'
require 'pry-debugger'
# TweetStream.configure do |config|
# config.consumer_key = 'abcdefghijklmnopqrstuvwxyz'
# config.consumer_secret = '0123456789'
# config.oauth_token = 'abcdefghijklmnopqrstuvwxyz'
# config.oauth_token_secret = '0123456789'
require 'test_helper'
class Api::Beta::UsersControllerTest < ActionController::TestCase
def setup
for i in 1..100 do
FactoryGirl.create(:user)
end
@user = FactoryGirl.create(:user)
end