Can't parse string array
Opened this issue · 3 comments
I have the following data in a field skills
:
{Networking,"Network Security","High distributed Applications","Web Application Development.","Programming: C",C++,"Core Java","J2EE Platform",Jquery,Javascript,PHP,"Objective C","Visual Studio",Cocoa,"Android.
Web: Ajax",JSON,Xquery,XML,HTML,CSS,"Apache.
Scripting: Python",Perl,Shell,"php.
Database: mySQL","Oracle 9i",Oracle10g,"Sqlite.
MVC Framework: Java Struts 2.0",Velocity,"Django.
Development Tools: gcc",gdb,"Eclipse IDE",emacs,Xcode,"tshark.
Interests: Systems","Cloud Computing",Algorithms,"Web Technologies and Development","Mobile Development.",JAVA,"C programming","C++ programming",Python,Django,SQL,"Jquery / Javascript","PHP development",Apache,"XML Schema",XQuery,"Oracle Spatial",Android,AJAX,MVC,"J2EE Architecture","Network Programming","Web Development",Japanese,"Distributed Systems",Objective-C,VPN,"VPN Protocols","Computer Software"}
When accessing the array user.skills
I get the following error:
irb(main):097:0> u.skills
NoMethodError: undefined method `captures' for nil:NilClass
from /Users/bhilkert/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-postgres-array-0.0.7/lib/activerecord-postgres-array/string.rb:23:in `from_postgres_array'
Following the code, it seems match(/\{(.*)\}/) => nil
and therefore blows up when sending captures
on it. I'm a little baffled what's different about this field and have tried taking out certain characters with no luck.
Let me know if I'm missing something obvious.
It appears the link breaks broke it. I'll filter them out.
Hi Brandon,
The problem was to do with multi-line content, the regex didn't have
the \m modifier set. I've fixed the issue and built a new version of
the gem (0.0.8).
Enjoy.
Tim
On 6 August 2012 01:06, Brandon Hilkert
reply@reply.github.com
wrote:
I have the following data in a field
skills
:{Networking,"Network Security","High distributed Applications","Web Application Development.","Programming: C",C++,"Core Java","J2EE Platform",Jquery,Javascript,PHP,"Objective C","Visual Studio",Cocoa,"Android. Web: Ajax",JSON,Xquery,XML,HTML,CSS,"Apache. Scripting: Python",Perl,Shell,"php. Database: mySQL","Oracle 9i",Oracle10g,"Sqlite. MVC Framework: Java Struts 2.0",Velocity,"Django. Development Tools: gcc",gdb,"Eclipse IDE",emacs,Xcode,"tshark. Interests: Systems","Cloud Computing",Algorithms,"Web Technologies and Development","Mobile Development.",JAVA,"C programming","C++ programming",Python,Django,SQL,"Jquery / Javascript","PHP development",Apache,"XML Schema",XQuery,"Oracle Spatial",Android,AJAX,MVC,"J2EE Architecture","Network Programming","Web Development",Japanese,"Distributed Systems",Objective-C,VPN,"VPN Protocols","Computer Software"}
When accessing the array
user.skills
I get the following error:irb(main):097:0> u.skills NoMethodError: undefined method `captures' for nil:NilClass from /Users/bhilkert/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-postgres-array-0.0.7/lib/activerecord-postgres-array/string.rb:23:in `from_postgres_array'
Following the code, it seems
match(/\{(.*)\}/) => nil
and therefore blows up when sendingcaptures
on it. I'm a little baffled what's different about this field and have tried taking out certain characters with no luck.Let me know if I'm missing something obvious.
Reply to this email directly or view it on GitHub:
#16
Awesome. Worked perfect!!!! Thank you for this gem.