This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user@red ~]$ gem install pg | |
Building native extensions. This could take a while... | |
ERROR: Error installing pg: | |
ERROR: Failed to build gem native extension. | |
/home/user/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb | |
checking for pg_config... yes | |
Using config values from /usr/bin/pg_config | |
checking for libpq-fe.h... no | |
Can't find the 'libpq-fe.h header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
body { | |
margin: 0px; | |
padding: 0px; | |
} | |
#myCanvas { | |
border: 1px solid red; | |
width: 99.9%; | |
height: 1000px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
belongs_to :gift | |
belongs_to :user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post | |
def youtube_url=(value) | |
self.youtube=value.gsub("http://.../","") | |
end | |
def youtube_url | |
youtube | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hey guys, since current_user is a method used in every request I decided to give it a few benchmarks | |
I'm gisting this so if anyone may find good literature | |
here was my start point question: | |
which is best? | |
(yes this approach doesn't validate an auth token) | |
def current_user | |
if session[:user_id] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT `sales`.* FROM `sales` | |
INNER JOIN `properties` ON `properties`.`id` = `sales`.`property_id` | |
WHERE (properties.zip = 33160) | |
ORDER BY sale_date DESC | |
LIMIT 10 | |
Duration 56,163 ms | |
Explain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Failures: | |
1) SessionsController GET 'destroy' returns http success | |
Failure/Error: get 'destroy' | |
NameError: | |
undefined local variable or method `root_path' for #<SessionsController:0x9c8a088> | |
# ./app/controllers/sessions_controller.rb:20:in `destroy' | |
# ./spec/controllers/sessions_controller_spec.rb:18:in `block (3 levels) in <top (required)>' | |
2) users/index renders a list of users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fabricator(:state) do | |
name { Faker::Address.city } | |
end | |
Fabricator(:city) do | |
state #{ Fabricate(:state) } | |
name { Faker::Address.city } | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new # guest user | |
can :read, Band | |
can :create, Band do |band| | |
user.persisted? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe "bands/show" do | |
before(:each) do | |
@band = assign(:band, Fabricate(:band)) | |
end | |
it "renders page" do | |
render | |
end |