Skip to content

Instantly share code, notes, and snippets.

@incorvia
incorvia / gist:1221131
Created September 16, 2011 03:26
Production.log
Started GET "/users" for 71.174.139.102 at 2011-09-16 07:16:06 +0400
Processing by UsersController#index as HTML
Completed 500 Internal Server Error in 2ms
ActiveRecord::StatementInvalid (Mysql2::Error: Table 'kdot.users' doesn't exist: SHOW FIELDS FROM `users`):
app/controllers/users_controller.rb:5:in `index'
Started GET "/users" for 71.174.139.102 at 2011-09-16 07:19:47 +0400
@incorvia
incorvia / gist:1221138
Created September 16, 2011 03:36
Production.log
Started GET "/users" for 71.174.139.102 at 2011-09-16 07:22:11 +0400
Processing by UsersController#index as HTML
Completed 500 Internal Server Error in 1ms
ActiveRecord::StatementInvalid (Mysql2::Error: Table 'kdot.users' doesn't exist: SHOW FIELDS FROM `users`):
app/controllers/users_controller.rb:5:in `index'
Migrating to CreateUsers (20110915234605)
Command:
User.joins(:tags).select("users.email, tags.tag_name")
SQL:
SELECT users.email, tags.tag_name FROM `users` INNER JOIN `notecards` ON `notecards`.`user_id` = `users`.`id` INNER JOIN `associations` ON `associations`.`notecard_id` = `notecards`.`id` INNER JOIN `tags` ON `tags`.`id` = `associations`.`tag_id`
ruby-1.9.2-p290 :214 > User.joins(:tags).select("users.email, tags.tag_name as tag_name")
User Load (1.3ms) SELECT users.email, tags.tag_name as tag_name FROM `users` INNER JOIN `notecards` ON `notecards`.`user_id` = `users`.`id` INNER JOIN `associations` ON `associations`.`notecard_id` = `notecards`.`id` INNER JOIN `tags` ON `tags`.`id` = `associations`.`tag_id`
=> [#<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "incorvia@gmail.com">, #<User email: "inco
resources :users do
resources :tags
end
=============================================
this works: tag_name is passed as a paramater {"tag_name"=>"@books"}
==============================================
match '/tags/:tag_name', :to => "tags#show"
== Install
Add to gemfile:
gem 'compass', '~> 0.12.alpha'
Initialize compass with the rails project by moving into directory and running:
compass init rails --using blueprint
Failures:
1) PagesController Title should have the correct title
Failure/Error: response.should have_selector('title'){ |tag| tag.inner_text.should == "Body Harmony | About Us" }
expected css "title" to return something
# ./spec/controllers/pages_controller_spec.rb:47:in `block (3 levels) in <top (required)>'
Finished in 0.33725 seconds
8 examples, 1 failure
/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -rrubygems -S /Users/Kevin/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/Kevin/Documents/Code/Rails/work/BodyHarmony/spec/controllers/pages_controller_spec.rb'
/Users/Kevin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
.......F
Failures:
1) PagesController Title should have the correct title
Failure/Error: response.should have_selector('title'){ |tag| tag.inner_text.should == "Body Harmony | About Us" }
expected css "title" to return something
# ./spec/controllers/pages_controller_spec.rb:47:in `block (3 levels) in <top (required)>'
/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -rrubygems -S /Users/Kevin/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.6.4/bin/rspec --tty '/Users/Kevin/Documents/Code/Rails/work/BodyHarmony/spec/controllers/pages_controller_spec.rb'
/Users/Kevin/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
.......F
Failures:
1) PagesController Title should have the correct title
Models
User
has_many :friendships
has_many :friends, :through => friendships
has_many :invites
has_many :events :through => invites
Friendship