[Rails] Re: Getting strange logouts after Rails3 migration

2011-04-07 Thread Erik Lindblad
appreciated. /Erik On 7 Apr, 23:31, Erik Lindblad erik@gmail.com wrote: Thx, this really made my day, having somewhere to start. Do you know how to do it from jquery? Regards Erik On 7 Apr, 22:59, Paul p...@nines.org wrote: Yes, the problem is the authenticity token needs

[Rails] Re: Getting strange logouts after Rails3 migration

2011-04-07 Thread Erik Lindblad
I found out how to do it. Add this to the URL: ?authenticity_token=' + encodeURIComponent('%= form_authenticity_token %) Entering here if someone else needs it. Thanks for the help, Rails community rocks as usual. /Erik On 7 Apr, 23:31, Erik Lindblad erik@gmail.com wrote: Thx

[Rails] Getting strange logouts after Rails3 migration

2011-04-07 Thread Erik Lindblad
Hi I recently migrated a Rails 2 app to Rails 3 and switched to Devise in the process. It is working well apart from one strange phenomenon. When I do redirects using javascript the user is logged out. Has anyone experienced something similar? Kindest regards Erik Lindblad -- You received

[Rails] Re: Getting strange logouts after Rails3 migration

2011-04-07 Thread Erik Lindblad
js library. Here's how to access the data you need using prototype: var csrf_param = $$('meta[name=csrf-param]')[0].content; var csrf_token = $$('meta[name=csrf-token]')[0].content; On Thu, Apr 7, 2011 at 3:11 PM, Erik Lindblad erik@gmail.com wrote: Hi I recently migrated a Rails

[Rails] Persistent objects

2010-03-27 Thread Erik Lindblad
Is there a way to create an object that is a singleton (one instance per user session) and is kept as long as the user session exists? The object handles a connection to a remote server that is very heavy to establish so I would like to reuse the same object in following requests. I have tried

[Rails] Re: Persistent objects

2010-03-27 Thread Erik Lindblad
15:44, Erik Lindblad e...@aldm.se wrote: Is there a way to create an object that is a singleton (one instance per user session) and is kept as long as the user session exists? The object handles a connection to a remote server that is very heavy to establish so I would like to reuse

[Rails] Re: Persistent objects

2010-03-27 Thread Erik Lindblad
...@gmail.com wrote: On Mar 27, 5:33 pm, Erik Lindblad e...@aldm.se wrote: Hi Colin and thanks for the suggestion. But the problem is more intricate than this, I am afraid. The reason I want to keep the object is that it connects via sockets to a pool of servers (at least 4 of them). When

[Rails] Testing helpers with RSpec

2010-01-26 Thread Erik Lindblad
Hi all I have a helper that generates HTML for dynamically adding items to a class. It uses Formtastic for the fields: module Admin module CompetitionsHelper def add_competition_class_link(form_builder) link_to_function Add competition class do |page|

[Rails] Is ActiveResource the way to go?

2009-09-24 Thread Erik Lindblad
Hi I am building a platform where I need to communicate between Rails instances (as well as Java applications) and I am thinking about using ActiveResource. However I run into some problems with Not all elements respond to to_xml since my XML format is nested and Array has no to_xml method. Are

[Rails] Provide missing image

2009-08-02 Thread Erik Lindblad
/to/default/image for the image to show in case the primary one does not exist. So my questions are: Has anyone done something similar before and if so is there a gem or similar for public use? Thanks in advance Erik Lindblad --~--~-~--~~~---~--~~ You received this message

[Rails] Re: Provide missing image

2009-08-02 Thread Erik Lindblad
Asked and answered. Looked through the Paperclip source and found the default_url parameter. Thanks to Thoughtbot :-) /Erik On 2 Aug, 19:52, Erik Lindblad e...@aldm.se wrote: Hi I have an application where people can upload avatar-like images to the site. When I show the images I want

[Rails] Correct regexp for Apache Expires headers

2009-07-12 Thread Erik Lindblad
with it. It also runs well in Ruby, though I am not 100% of the compatibility between Ruby and Perl regexp. Does anyone have a working regexp for this? Regards Erik Lindblad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby

[Rails] Re: Substituting single quotes in strings

2008-12-16 Thread Erik Lindblad
Thanks I did not think about the potential back reference for regexps. Good catch. Regards Erik On 16 Dec, 17:06, Frederick Cheung frederick.che...@gmail.com wrote: On 16 Dec 2008, at 15:01, Erik Lindblad wrote: Hi I want to substitute single quotes in a string but fails unless

[Rails] Substituting single quotes in strings

2008-12-16 Thread Erik Lindblad
Hi I want to substitute single quotes in a string but fails unless resorting to overkill (imho) techniques like blocks: s = ab'cd = ab'cd s.sub(') {|s| %q{\'} } = ab\\'cd As seen this method works but why can't I do something like a.sub(', %q{\'}) = aaabb when a.sub(', %q{h}) =