View gist:194291
You have a nil object when you didn't expect it! | |
You might have expected an instance of ActiveRecord::Base. | |
The error occurred while evaluating nil.[] (NoMethodError) | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/formatter/console.rb:132:in `print_tag_limit_warnings' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/formatter/console.rb:130:in `each' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/formatter/console.rb:130:in `print_tag_limit_warnings' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/formatter/pretty.rb:232:in `print_summary' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/formatter/pretty.rb:27:in `after_features' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/ast/tree_walker.rb:170:in `__send__' | |
/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.103/bin/../lib/cucumber/ast/tree_walker.rb:170:in `send_to_all' |
View gist:217169
title = "abc" | |
[1,2].each do |p| | |
puts title | |
end |
View gist:217203
+----+-------------+-------------+-------------------+-------------------+-----------------+----------+ | |
| id | component_a | component_b | component_a_model | component_b_model | connection_type | position | | |
+----+-------------+-------------+-------------------+-------------------+-----------------+----------+ | |
| 19 | 7 | 3 | 1 | 2 | 1 | NULL | | |
| 20 | 3 | 7 | 2 | 1 | 1 | NULL | |
View ul li last:child
<style> | |
ul li:first-child { | |
color: green; | |
} | |
ul li:last-child { | |
color: red; | |
} | |
</style> | |
<ul> | |
<li>1</li> |
View gist:648728
sec1 = "(1) toplama" | |
sec2 = "(2) çıkarma" | |
sec3 = "(3) çarpma" | |
sec4 = "(4) bölme" | |
puts sec1 | |
puts sec2 | |
puts sec3 | |
puts sec4 |
View sinatra-testing-with-sessions.rb
# Middleware: my_app.rb | |
class MyApp < Sinatra::Base | |
enable :sessions | |
get '/testing' do | |
puts env['rack.session'].inspect | |
'testing' | |
end | |
end |
View my_app_spec.rb
it "tests something..." do | |
sess = {'warden.user.user.key' => [User, User.first.id]} | |
encoded = [Marshal.dump(sess)].pack("m*") | |
get "/testing", {}, {'HTTP_COOKIE' => "rack.session=" + encoded} | |
end |
View action_mailer_ext.rb
# config/initializers/action_mailer_ext.rb | |
# For Rails 2.x | |
if Rails.env.staging? | |
class ActionMailer::Base | |
def recipients(*params) | |
@recipients = "staging@example.com" | |
end | |
View gist:1127666
<div style="background-color: green; width:500px; height: 500px">Text</div> |
View gist:1141681
# eg: I am on the advertisers ad campaign's the ad's edit page | |
when /^the (.+?) #{capture_model}(?:'s)? #{capture_model}(?:'s)? (.+?) page$/ | |
polymorphic_path [$1.to_sym, model($2), model($3)], :action => $4 | |
# eg: I am on the advertisers the ad campaign's the ad's page | |
when /^the (.+?) #{capture_model}(?:'s)? #{capture_model}(?:'s)? page$/ | |
polymorphic_path [$1.to_sym, model($2), model($3)] | |
# eg: I am on the advertisers the ad's edit page | |
when /^the (.+?) #{capture_model}(?:'s)? (.+?) page$/ |
OlderNewer