Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixing the Arel::Nodes::SqlLiteral Psych dump issue #169

Closed
wants to merge 1 commit into from

4 participants

@mdesantis

I don't know if it is an acceptable solution; anyway, I defined custom encode_with and init_with methods for Arel::Nodes::SqlLiteral which restores the Psych dump of SqlLiteral instances (issue #149).

@mdesantis mdesantis Custom encode_with and init_with (fixes #149)
It declares encode_with and init_with for Arel::Nodes::SqlLiteral, which restores the dump / load with Psych.
7e753a2
@prathamesh-sonpatki

Got this from @codetriage. @ProGNOMmers any updates on this issue?

@mdesantis

I'm still using the monkeypatch of the issue #149 and I've never got problems (it is inside the code of a couple of web apps in production)

@tamird

obsolete: was fixed in fcb00d3. good to close

@matthewd matthewd closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 4, 2013
  1. @mdesantis

    Custom encode_with and init_with (fixes #149)

    mdesantis authored
    It declares encode_with and init_with for Arel::Nodes::SqlLiteral, which restores the dump / load with Psych.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/arel/nodes/sql_literal.rb
View
8 lib/arel/nodes/sql_literal.rb
@@ -5,6 +5,14 @@ class SqlLiteral < String
include Arel::Predications
include Arel::AliasPredication
include Arel::OrderPredications
+
+ def encode_with(coder)
+ coder['string'] = self.to_s
+ end
+
+ def init_with(coder)
+ self << coder['string']
+ end
end
class BindParam < SqlLiteral
Something went wrong with that request. Please try again.