ruby-on-rails

Ruby on Rails application could not be started

I put my first Rails app online on Dreamhost, but I keep getting "Ruby on Rails application could not be started" (you can see it directly). Then running rake exiftool process seems to be killed by DH: sh: line 1: 10645 Killed convert "/tmp/stream20090806-10125-x36lrj-0[0]" -resize "x150" -crop "150x150+25+0" +repage "/tmp/stream2009080...

Accessing post data in controller

I am iterating through a hash and displaying the values as radio buttons. The hash looks like this: { 1=>["a", "b"], 2=>["c"], 3=>["a", "d", "f", "g"], 4=>["q"] .. } After selecting the values, the parameters become: { "commit"=>"vote", "authenticity_token"=>"db863239855c9f73b9ae54c37f6b92c858acb56f", "1"=>"a", "2"=...

Can i redirect_to in a new window

Hello, I have a list of links that users can click. When a click is made, I want to increment a counter (to track how many users clicked that link) and then open the link in a new window. Right now, in the 'show' method method, I can do all that except the "new window" thing. Is there a way to achieve this in pure rails or do I have to ...

Find DOM element by ID when ID contains square brackets?

I have a DOM element with an ID similar to: something[500] which was built by my Ruby on Rails application. I need to be able to get this element via jQuery so that I can traverse my way up the DOM to delete the parent of it's parent, which has a variable ID that I don't have access to beforehand. Does anyone know how I could go abo...

Javascript history.back() not working in rails app

Hey I'm calling history.back() on the on-click of a 'back' button in a rails app. But nothing happens. There is history in the browser -- pressing the browser's back button takes me back to the correct page. If I use history.go(-2) however, the page goes back correctly. So why do I have to tell javascript to go back two pages instead of...

Rails group by year problem

I have a Post model which includes a date_published. I want to display links on the index page to view all the posts of a certain year (a bit like where blogs have months you can view by) The only way I can think of returning the years is by iterating over all of the posts and returning a unique array of the years that posts fall in. Bu...

Running Rails Application on netbeans 6.7 error

i was upgrading my Netbeans 6.5 to Netbeans 6.7 and i open my rails application which built on Netbeans 6.5 and i run but it doesnt working , said : java.lang.NoClassDefFoundError: org/jruby/Main Caused by: java.lang.ClassNotFoundException: org.jruby.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at ja...

First Rails Project: Rake Problem

I'm running rails on Mac OS X. I think I installed it correctly, but I'm getting the following error. $ rake db:create (in /Users/user_name/myapp) rake aborted! Could not find RubyGem mocha (>= 0) (See full trace by running task with --trace) What is the problem? How do I fix it? ...

Is there a name to this Ruby on Rails common model pattern? Polylink?

There seems to be no name for this common model pattern. It's used in many plugins like acts_as_taggable[_whatever] and it basically allows linking a certain model, like Tag, with any other model without having to put ever-more belongs_to statements in the Tag model. It works by having your model (Tag) linked to a polymorphic join mo...

Managing child relationships with a nested attribute form

What I'm trying to do is the following: At anyone time a user can have 1 active profile. This active profile must be authorized by an administrator to make sure that it is compliant with the rules and regulations of the site. When a user edits their profile their public profile is unaffected until the administrator signs off their cha...

Adding id column and populating it to an existing table in Rails?

Hello, I have an existing table that I'd like to use for a Rails application. It's a simple table with only 4 columns. However it does not yet have id column. And also new data will be added periodically. I am trying to find a way to add the id column and populate it. I guess I have two options, but being a noob I am sure there are b...

Rails partial locals not persisting when sent to another partial as its own local

I render a partial like so: <%= render :partial => 'widgets/some_partial, :locals => {:foo => 'bar'} %> So inside of _some_partial.html.erb I render two more partials like so: <% #foo.nil? #=> false %> <%= render :partial => 'widgets/another_partial', :locals => {:foo => foo} %> `<%= render :partial => 'widgets/another_partial_again'...

Ruby on rails: rubygem error

I having a problem: $ rake db:create (in /Users/devinross14/myapp) rake aborted! RubyGem version error: rake-compiler(0.6.0 not ~> 0.5.0) (See full trace by running task with --trace) How do I fix this? ...

Using Jeremy Mcanally's context for testing in Rails 2.3.x

I'd like to try out Jeremy Mcanally's context gem for testing: http://github.com/jeremymcanally/context/tree/master It does not work out of the box with Rails 2.3.x, anyone got it working? EDIT hi mike, tx for ur help. i installed the gem like u said, and have added "require 'context'" to test_helper.rb however, it stil doesn't seem t...

Rails : recognized route

Is there any way to get hold of the route recognized by rails given a path? Current implementation of rails in the methods "recognize_path" && "recognize" returns just the hash with the :controller, :action and :id (if available) and any other url attributes. But I would like to get the route object (wihtin the ActionController::Routin...

Regex: Match a string containing numbers and letters but not a string of just numbers.

Question I would like to be able to use a single regex (if possible) to require that a string fits [A-Za-z0-9_] but doesn't allow: Strings containing just numbers or/and symbols. Strings starting or ending with symbols Multiple symbols next to eachother Valid test_0123 t0e1s2t3 0123_test te0_s1t23 t_t Invalid t__t ____ 0123012...

Bash Command which Rails does Not Find

Passenger says: Ruby on Rails application could not be started ... Command 'exiftool' not found (MiniExiftool::Error) When I login with ssh and I type exiftool in any directory the command works properly. I have the follwing line in both .bash_profile and .bashrc export PATH=$PATH:$HOME/bin Is it possible that Rails (MiniExiftool pl...

Foreign keys in fixtures in rails 2.0

I'm having problems with my fixtures in Rails. I have two models, a message and a user. The user model is generated from restful authentication. A message has a sender and a recipient, which are both users. When I don't use the fixtures everything works fine. But when I try to use them in fixtures both are nil. This is the messages fi...

Patch a Ruby Gem

What is the best way to apply a simple patch to a Ruby gem in a Rails app? Is it possible to keep the original gem code untouched? ...

periodically_call_remote: Rails AJAX for a facebook app

hi! i'm building a RoR app for facebook using FBML and the Prototype JavaScript library. what i'm trying to do is have a div automatically refreshed, using the neat periodically_call_remote, which creates a PeriodicalExecuter object. here's the code: <%= render :partial => "status_item", :collection => @status %> <%= periodically_...