Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
@dylanerichards
dylanerichards / gist:7746055
Created December 2, 2013 06:58
rake db:migrate:status
Status Migration ID Migration Name
--------------------------------------------------
up 20131127214749 Devise create users
up 20131127230950 Create things
up 20131128023813 Add user id to things
up 20131128132151 Add attachment image to things
up 20131128204843 Add name to users
up 20131128212513 Add username to users
up 20131130164610 Add attachment avatar to users
up 20131201225659 ********** NO FILE **********
@dylanerichards
dylanerichards / gist:7746081
Created December 2, 2013 07:02
After running db:reset
-- create_table("active_admin_comments", {:force=>true})
-> 0.0069s
-- add_index("active_admin_comments", ["author_type", "author_id"], {:name=>"index_active_admin_comments_on_author_type_and_author_id"})
-> 0.0018s
-- add_index("active_admin_comments", ["namespace"], {:name=>"index_active_admin_comments_on_namespace"})
-> 0.0024s
-- add_index("active_admin_comments", ["resource_type", "resource_id"], {:name=>"index_active_admin_comments_on_resource_type_and_resource_id"})
-> 0.0023s
-- create_table("things", {:force=>true})
-> 0.0028s
@dylanerichards
dylanerichards / gist:7746092
Created December 2, 2013 07:03
After migrate
== DeviseCreateAdminUsers: migrating =========================================
-- create_table(:admin_users)
-> 0.0050s
-- add_index(:admin_users, :email, {:unique=>true})
-> 0.0008s
-- add_index(:admin_users, :reset_password_token, {:unique=>true})
-> 0.0006s
== DeviseCreateAdminUsers: migrated (0.0068s) ================================
== CreateActiveAdminComments: migrating ======================================
@dylanerichards
dylanerichards / gist:7746352
Created December 2, 2013 07:47
new thing_params
def thing_params
params.require(:thing).permit(:title, :description, :image, :image_file_name, :image_content_type, :image_file_size, :image_uploaded_at, :commit, :id, :image_updated_at)
end
@dylanerichards
dylanerichards / gist:7746440
Created December 2, 2013 08:00
latest thing_params
def thing_params
params.require(:thing).permit(:title, :description, :image, :image_file_name, :image_content_type, :image_file_size, :user_id, :image_updated_at(1i), :image_updated_at(2i), :image_updated_at(3i), :image_updated_at(4i), :image_updated_at(5i))
end
Started PATCH "/admin/things/2" for 127.0.0.1 at 2013-12-02 03:14:29 -0500
Processing by Admin::ThingsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"zK81OjA3forTTUwfj8sAQv8mKTnI4KbXKR2Vl/QW8ow=", "thing"=>{"user_id"=>"1", "title"=>"o", "description"=>"o", "image_file_name"=>"Screen_shot_2013-11-27_at_3.21.41_PM.png", "image_content_type"=>"image/png", "image_file_size"=>"44026", "image_updated_at(1i)"=>"2013", "image_updated_at(2i)"=>"12", "image_updated_at(3i)"=>"2", "image_updated_at(4i)"=>"07", "image_updated_at(5i)"=>"43"}, "commit"=>"Update Thing", "id"=>"2"}
AdminUser Load (0.3ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 ORDER BY "admin_users"."id" ASC LIMIT 1
Thing Load (0.2ms) SELECT "things".* FROM "things" WHERE "things"."id" = ? LIMIT 1 [["id", "2"]]
Completed 500 Internal Server Error in 4ms
ActiveModel::ForbiddenAttributesError (ActiveModel::ForbiddenAttributesError):
activemodel (4.0.1) lib/active_model/forbidden_attributes_pr
@dylanerichards
dylanerichards / devise.rb
Created December 9, 2013 19:42
I am trying to incorporate Devise, Omniauth, and Facebook into my Rails 4 application.
Devise.setup do |config|
require "omniauth-facebook"
config.omniauth :facebook, "186855861506807", "d35a2cab845ada8ff2036c6f7b3281cd"
config.secret_key = '1a1e48f23c2756567caf48b37bd659a87f28fa18c8a9a5eb47d7b595e222c82b57787e66be3d51a515f7c8d43a2bbeb721a412830d6247ba144a32ad14755610'
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
require 'devise/orm/active_record'
@dylanerichards
dylanerichards / Log Output
Last active December 30, 2015 23:49
User returning nil. On line 17 of index.html.erb. Undefined method "username" for nilNilclass
Started GET "/" for 127.0.0.1 at 2013-12-10 20:02:52 -0500
Processing by ThingsController#index as HTML
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 ORDER BY "users"."id" ASC LIMIT 1
Thing Load (0.3ms) SELECT "things".* FROM "things" ORDER BY created_at DESC LIMIT 50 OFFSET 0
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 3]]
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 1]]
Rendered things/index.html.erb within layouts/application (12.7ms)
Completed 500 Internal Server Error in 19ms
ActionView::Template::Error (undefined method `username' for nil:NilClass):
@dylanerichards
dylanerichards / application.js
Created December 28, 2013 14:09
I am trying to remove the hardcoded @username value and create a form that the user will use to set it himself.
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
@dylanerichards
dylanerichards / _form.html.erb
Last active January 2, 2016 02:48
undefined method `first_name' for nil:NilClass Error is in show.html.erb on line 4
<%= simple_form_for(@comment) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :body %>
<%= f.input :guide_id %>
<%= f.input :user_id %>
</div>
<%= f.hidden_field :guide_id %>