Skip to content

Instantly share code, notes, and snippets.

View SoldierCoder's full-sized avatar
💭
learning stuff

Ed Drain SoldierCoder

💭
learning stuff
View GitHub Profile
require "rubygems"
gem "activerecord"
# intermediate scaffolding example -- a roster is a list of Students in a particular course
> ruby script/generate scaffold Roster course:reference student:reference
ArgumentError in RostersController#create
wrong number of arguments (1 for 0)
RAILS_ROOT: C:/rails20/rails_apps/gradebook
Application Trace | Framework Trace | Full Trace
app/controllers/rosters_controller.rb:44:in `params'
app/controllers/rosters_controller.rb:44:in `create'
Request
<h1>New roster</h1>
<%= error_messages_for :roster %>
<% form_for(@roster) do |f| %>
<p>
<b>Course</b><br />
<%= collection_select(:course, :id, @courses, :id, :name ,{:prompt => true}) %><br />
</p>
@SoldierCoder
SoldierCoder / SoldierCoderControllerQuestion
Created September 28, 2011 00:43
models and a controller question
Ok, users should get a list of campaigns (to add or withdraw support
to/from whether or not they support it now. But I also want to to
show if they are supporting it.
CampaignSupporters will hold information about which users
currently support which campaigns. But how do i get list
of all campaigns so logged in user can choose which they'd
like to support?
is User saved after first end below?
class User < ActiveRecord::Base
has_many :campaign_supporters
has_many :campaigns, :through => :campaign_supporters
def self.create_with_omniauth(auth)
create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
@SoldierCoder
SoldierCoder / tweettest.rb
Created October 4, 2011 18:05
tweetest fails! why??
# TweetTest.rb
require 'rubygems'
require 'twitter' # <<<--- this is line 6
@SoldierCoder
SoldierCoder / gist:1270676
Created October 7, 2011 16:07
How do i get out of this hell?
C:\railApps\voice>rake spec
You have requested:
faraday ~> 0.7.4
The bundle currently has faraday locked at 0.6.1.
Try running `bundle update faraday`
C:\railApps\voice>bundle update faraday
Fetching source index for http://rubygems.org/
You have requested:
@SoldierCoder
SoldierCoder / gist:1278692
Created October 11, 2011 17:06
heck if i know whats up with this?
ActiveRecord::RecordNotFound in HomeController#index
Couldn't find User with id=15
Rails.root: C:/railApps/voice
Application Trace | Framework Trace | Full Trace
app/controllers/application_controller.rb:9:in `current_user'
app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb__676006747_12853416'
Request
@SoldierCoder
SoldierCoder / gist:1307208
Created October 23, 2011 10:15
my git battles.
$ git remote add origin git@github.com:SoldierCoder/Lend-Me-Your-Voice.git
Ed Drain@YOUR-P3FQG2KMAW /c/Lend-Me-Your-Voice (master)
$ git push origin master
Enter passphrase for key '/c/Documents and Settings/Ed Drain/.ssh/id_rsa':
Enter passphrase for key '/c/Documents and Settings/Ed Drain/.ssh/id_rsa':
Enter passphrase for key '/c/Documents and Settings/Ed Drain/.ssh/id_rsa':
Counting objects: 129, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (112/112), done.