Skip to content

Instantly share code, notes, and snippets.

View dylanerichards's full-sized avatar

Dylan Richards dylanerichards

View GitHub Profile
Started POST "/guides/2-sdkfjsk/comments" for 127.0.0.1 at 2014-01-08 09:14:59 -0500
Processing by CommentsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"D2BvBIgU+tniZvr2NgQE/TpHY6J2xHOUm701jqTcJ9A=", "comment"=>{"body"=>"", "user_id"=>"some value"}, "{:id=>\"comments_guide_id\", :name=>\"comments"=>{"guide_id"=>{"\", :value=>2}"=>""}}, "commit"=>"Create Comment", "guide_id"=>"2-sdkfjsk"}
Completed 500 Internal Server Error in 1ms
NoMethodError (undefined method `[]=' for nil:NilClass):
app/controllers/comments_controller.rb:27:in `create'
@dylanerichards
dylanerichards / guide.rb
Created January 4, 2014 04:50
How do I print out a list of users in order of score from greatest to least?
class Guide < ActiveRecord::Base
belongs_to :user
acts_as_votable
def score
upvotes.count - downvotes.count
end
end
@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 %>
@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 / 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 / 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'
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 / 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
@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: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 ======================================