ruby-on-rails

vlad the deployer vlad:start_app with passenger issue

I'm trying to deploy a rails app using vlad the deployer. I'm using nginx and passenger. I have an issue with the vlad:start_app task. When I deploy I get the following issue touch: cannot touch `/var/www/mysite.com/releases/20100623130302/tmp/restart.txt': No such file or directory rake aborted! execution failed with status 1: ssh ...

Authlogic Facebook Connect and SSL

User_sessions has ssl_required for new, create and destroy. If I use authlogic_facebook_connect_button from an ssl page everything works, if I use it from a non-ssl page like the front it fails with a "Unknown Action / No action responded to index" Please help... Is there a way to authlogic_facebook_connect_button to use xd_receiver_s...

cron tab to restart my delayed_job server.

I want to create a cront tab to restart my delayed_job server if it breaks. how may check that my delayed_job server is running or not with ps command? how may i create a cron tab to check this thing work? Like if my server break than cron tab will restart it. I want to set cront tab to check it every 5 minute. ...

HAML select helper not ordering options correctly

Hello all, I'm trying to get some forms out, but I'm having trouble, in that HAML is not ordering the options in my select elements properly. Here is my echo statement: =select 'user', @empty_data, {"Less than $40k" => 1, "$40k - $70k" => 2, "$70k - $100k" => 3, "$100k+" => 4, "No Thanks" => 5 } However, when the HTML gets rendered,...

Running rails app, want to serve /blog from another server

Hi all, I'd like to server /blog from http://blog.domain.com. I'm using apache 2, rails 2.3, and passenger on ubuntu. I've tried this in the virtual host: <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass /blog http://blog.domain.com/ ProxyPassReverse /blog http://blog.domain.com/ But it's not proxying, it's trying to...

rails: sharing information between 2 apps

I've got this medium-sized app that is starting to get too complex. I'm considering splitting it in two. But I'm uncertain about how would I share information between those. I've been able to make two big groups of models; One group deals with "pictures" and the other one deals with "sales data". Some utility models, such as the authen...

How should I deal with estimated dates in Ruby on Rails?

Hello, For my application I need to handle estimated dates, for example "about Jun. 1940" needs to be accepted as plus or minus 2 years around Jun 1940. Or they could type "about 1940" needs to be accepted as plus or minus 2 years around 1940. Here is the full list of possible formats. 1940 Nov.1940 Nov. 1940 6 Nov.1940 6 Nov. 1940 A...

RubyRails: Mixing Sanitize and Truncate can be a dirty thing..

So stand alone I get what I need. But I want to truncate it, my dynamic text comes out with dirty text globbered with Microsoft Word garbage. An Example : &Lt;! [If Gte Mso 9]>&Lt;Xml> &Lt;Br /> &Lt;O:Office Document Settings> &Lt;Br /> &Lt;O:Allow Png/> &Lt;Br /> &Lt;/O:Off... So how do I get the best of both worlds? Is there a s...

Need help: unable to get Dexagogo's validation plugin to work in a Rails app

I am trying to use Dexagogo's validation plugin to validate a form in a rails app but unable to get it to work. I have a form like this: http://www.pastie.org/1016183 Its a Rails 2.3.5, Prototype: 1.6.0.3 and Dexagogo's validation plugin: 1.5.4.1 ...

Ruby on Rails: Cucumber: how do I follow a link that opens a new window?

I have a link that opens in a new window, and I need to test the part of my app that is within that new window. Any suggestions will be much appreciated. ...

Ruby on Rails - Global Variable?

Hello, I am a new Ruby on Rails user and had a question. I have an idea of what I want my Users DB to look like but was wondering whether or not I should add an additional value to it. Basically I need a variable to signal to all users that it is safe to proceed with a certain action. This variable would be persistent across all users a...

Sanitize pasted text from MS-Word

Here's my wild and whacky psuedo-code. Anyone know how to make this real? Background: This dynamic content comes from a ckeditor. And a lot of folks paste Microsoft Word content in it. No worries, if I just call the attribute untouched it loads pretty. But the catch is that I want it to be just 125 characters abbreviated. When I add tr...

Ruby on Rails - request.env['HTTP_REFERER'] returns nil

Hello everyone. I am trying to save the http_referer so I can send the user back to that url after he has logged in. Right now I have a before_filter in my controllers that sends them to a log in page if a session has not been created via a redirect_to. However when I check the HTTP_REFERER it is nil (whereas 'REQUEST_URI' does return w...

RAILS_ROOT with shell script.

I have created one shell script in my lib folder. And i want to use RAILS_ROOT in that script instead of the long path. Is there any way i can do this? This my script if ! [ -s delayed_job.pids ]; then RAILS_ENV=production /home/app/script/delayed_job start fi I want to modified this line with something like that. if ! [ -s d...

Submitting search query to Yahoo Web Search from Ruby on Rails app

Hi all, I want to perform a search query from my rails app, which uses the Yahoo Web Search service, and parse the response from the yahoo api, and populate the database based on this response. I wanted to know how can I go about submitting this query from my app in rails. And also, if there are any gems which let you do the same? T...

Adding Folder/Subfolders/files in Git

How can I add a folder recursively, with its subfolders and its files? When I use git add folder_name, only that folder is getting added. git status now shows the files under the subfolders are shown as new files and untracked. For example, in Rails application, inside the Rails project folder, there are many folders: app public db ...

Ruby on Rails: Xcode: Instruments: Trace/BPT trap? What is it, and how do I fix it?

So, I wanted to test my RoR app for memory leaks, and I was all like "Hey, Xcode has a tool for that".. So... I run the RoR server Then The moment I tell instruments to attach to the process, it dies, and tells me Trace/BPT trap What is Trace/BPT trap And how do I test my app for memory leaks? ...

Ruby on Rails decimal column

If you specify your ActiveRecord column type to be decimal, Rails will return that database value as a ruby BigDecimal object. My question is, when working with these fields and performing additional math on them, should I always use BigDecimal values in my calculations or are floating point values ok to use. I didn't know if it is a go...

Scalable Compliant DB for Rails App

We are in the process of selecting a database which will need to meet strict industry compliance, have good name recognition, and allow scalability (initially write around 100 ~5k transactions/sec., and respond with large record sets primarily at scheduled intervals, but it could very quickly grow beyond this). We are being advised to l...

Why I'm getting stack level too deep while triggering a job using resque-status?

Here is the stack trace which appears on resque-web interface: http://gist.github.com/396893 There you can check some gem versions that I was using. Now I have made some upgrades trying to solve the problem, here are the current gem versions: redis (2.0.3) redis-namespace (0.5.0) redisk (0.2.1) resque (1.9.5) resque-scheduler (1.9.2) re...