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 GistTest | |
def test(foo='bar') | |
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
class ActiveRecord::Base | |
# Returns hash prepared to be converted to json | |
# | |
# Can take the same options as ActiveRecord::Base#to_json | |
def prepare_json(options = {}) | |
if include_root_in_json | |
{ self.class.json_class_name => JsonSerializer.new(self, options).serializable_record } | |
else | |
JsonSerializer.new(self, options).serializable_record | |
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
Ruby 1.8.6 | |
| AR 2.2.1 | DM 0.9.7 | DIFF | | |
---------------------------------------------------------------------------------------- | |
Model.new (instantiation) x10000 | 0.541 | 0.049 | 11.02x | | |
Model.new (setting attributes) x10000 | 1.895 | 1.103 | 1.72x | | |
Model.get specific (not cached) x10000 | 9.964 | 19.736 | 0.50x | | |
Model.get specific (cached) x10000 | 12.432 | 1.227 | 10.14x | | |
Model.first x10000 | 10.063 | 11.966 | 0.84x | | |
Model.all limit(100) x1000 | 23.322 | 25.645 | 0.91x | | |
Model.all limit(100) with relationship x1000 | 48.873 | 67.983 | 0.72x | |
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
import com.db4o.*; | |
import com.db4o.activation.ActivationPurpose; | |
import com.db4o.activation.Activator; | |
import com.db4o.collections.ArrayList4; | |
import com.db4o.config.Configuration; | |
import com.db4o.diagnostic.Diagnostic; | |
import com.db4o.diagnostic.DiagnosticListener; | |
import com.db4o.query.*; | |
import com.db4o.ta.Activatable; | |
import com.db4o.ta.NotTransparentActivationEnabled; |
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
private | |
def set_cookie(name, value) | |
@search_options ||= {} | |
cookie_value = cookie[name] | |
if value != cookie_value | |
# jeżeli ciasteczko do tej pory miało inną wartość | |
# to zmień wartość ciasteczka i zapisz to do hasha z opcjami | |
cookies[name] = @search_options[name] = value | |
else |
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
| AR 2.2.2 | DM 0.9.8 | Sq 2.8.0 | | |
----------------------------------------------------------------------------------------- | |
Model.new (instantiation) x10000 | 0.643 | 0.060 | 9.764 | | |
Model.new (setting attributes) x10000 | 2.810 | 1.546 | 10.862 | | |
Model.get specific (not cached) x10000 | 11.510 | 24.749 | 16.524 | | |
Model.get specific (cached) x10000 | 12.190 | 1.165 | | | |
Model.first x10000 | 10.292 | 18.622 | 13.425 | | |
Model.all limit(100) x1000 | 31.162 | 38.043 | 33.985 | | |
Model.all limit(100) with relationship x1000 | 63.097 | 245.763 | 204.498 | | |
Model.all limit(10,000) x10 | 28.371 | 36.127 | 30.088 | |
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
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/associations/relationship.rb:106:in `send': undefined method `comments_association' for nil:NilClass (NoMethodError) | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/associations/relationship.rb:106:in `get_children' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/associations/relationship.rb:105:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/associations/relationship.rb:105:in `get_children' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/associations/relationship.rb:172:in `with_repository' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/support/kernel.rb:6:in `repository' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core.rb:181:in `repository' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core/repository.rb:44:in `scope' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.9/lib/dm-core.rb:181:in `repository' |
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 'rubygems' | |
require 'dm-core' | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Article | |
include DataMapper::Resource | |
property :id, Serial |
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
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/adapters/data_objects_adapter.rb:79:in `execute_reader': ambiguous column name: articles.id (Sqlite3Error) | |
Query: SELECT "articles"."id", "articles"."name" FROM "articles" INNER JOIN "articles" ON "articles"."id" = "comments"."commentable_id" WHERE "articles"."id" = '3' AND "comments"."commentable_class" = 'Article' ORDER BY "articles"."id" LIMIT 1 from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/adapters/data_objects_adapter.rb:79:in `read_one' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/adapters/data_objects_adapter.rb:202:in `with_connection' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/adapters/data_objects_adapter.rb:74:in `read_one' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/repository.rb:131:in `read_one' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/model.rb:339:in `first' | |
from /usr/lib/ruby/gems/1.8/gems/dm-core-0.9.8/lib/dm-core/ass |
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
= form_for @comment, :action => slice_url(:comments) do | |
= text_area :body | |
= submit "Send" |
OlderNewer