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
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
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" | |
class Word | |
include DataMapper::Resource | |
property :id, Serial | |
property :text, String | |
has n, :translations #, :model => 'Word', :foreign_key => [:word_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
This is gist. | |
There are many like it, but this one is mine. | |
It is my life. | |
I must master it as I must master my life. | |
Without me gist is useless. | |
Without gist, I am useless. |
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
module Rack | |
class AllYourBase | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
end | |
def call(env) | |
@request = Rack::Request.new(env) |
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
Error | |
ActiveRecord::StatementInvalid in Admin/dashboardController#show | |
PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list | |
LINE 1: ...comments ON comments.post_id = posts.id ORDER BY comments.c... | |
^ | |
: SELECT distinct posts.* FROM "posts" INNER JOIN comments ON comments.post_id = posts.id ORDER BY comments.created_at DESC LIMIT 5 | |
Application Trace | Framework Trace | Full Trace |
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 < ActiveRecord::Base | |
# [...] | |
named_scope :order_by , lambda { |order| { :order => (order) } } | |
named_scope :limit , lambda { |*lim| { :limit => (lim.first || DEFAULT_LIMIT) } } | |
named_scope :published_before, lambda { |*time| | |
{:conditions => [ "published_at < ?", (time.first || Time.now) ]}} | |
named_scope :with_comments, {:include=>:comments} | |
named_scope :remove_duplications, :select => 'distinct posts.*' |
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
==== Error | |
ActiveRecord::StatementInvalid (PGError: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list | |
LINE 1: ...comments ON comments.post_id = posts.id ORDER BY comments.c... | |
^ | |
: SELECT distinct posts.* FROM "posts" INNER JOIN comments ON comments.post_id = posts.id ORDER BY comments.created_at DESC LIMIT 5): | |
app/models/comment_activity.rb:18:in `find_recent' | |
app/controllers/admin/dashboard_controller.rb:4:in `show' | |
===== Controller |
NewerOlder