ruby-on-rails

Ruby on Rails: Confirmation Page for ActiveRecord Object Creation

Using Ruby on Rails I want a confirmation page before creating an ActiveRecord object. The user will see a preview of the item they are creating before submitting and the object being saved in the database A common pattern; User visits /entry/new User enters details and clicks submit User is redirected to /entry/confirm which display...

Separating presentation/web-services (RoR/Java)

Is it a good practice to develop web-service and web-site in two different languages, on two different servers? E.g. right now I create a Java web-service running on Glassfish and Ruby on Rails presentation layer running in the same server. I'd like to leave web-service on the same server but use Ruby 1.9, running in Passenger. Is it a...

"Finding" the "parent" object in a nested resource relationship?

Say that I have two resources, Project and Task. A Project can have many Tasks; A Task belongs to one Project. Also say that I have Task nested under Project in routes.rb: map.resources :projects do |project| project.resources :tasks end Can one programmatically discover this relationship? Basically, I need to dynamically load an ar...

Are CRLF lines ok in a Rails project deployed on Linux?

I have a Git repository (originally CVS, then SVN, now Git) containing a Rails project that has been deployed on Linux for a while now. Everything seems to run fine. Now that I've converted to git, I see that many of my files in the repository contain CRLF line endings. I'd love for it to all be consistent (LF), but not at the expense...

How to submit multiple models on rails using flex?

I am trying to submit a create and update request to rails using flex with multiple models. For example, imagine that we have a blog post and multiple comments. The user comes and update the post and some comments, when he clicks on submit I want to send all updates. If I send something like: var params:Object = new Object(); params[...

In Rails fixtures, who is Quentin?

In acts-as-authenticated, and now restful-authentication, the first user fixture is "Quentin." Just curious if anyone knows the origin of that name? Quentin Tarantino? Someone's dog or child? ...

Same partial on multiple views returning to whatever view it was called from

I'm currently re-using a partial on two different views. View A View B The partial belongs to Model A but has an association with Model B so it is applicable to Model B as well. It contains a form and when data is submitted, it always redirects the user to View A. However, when I submit the form from View B, I would like to...

RESTful way to do degradable Multiple Models in a Form in Rails

So far, I've not been able to find a solution that is able to allow a form to interact with two models that have a one-to-many relationship. Say for example, a customer has many items. Currently, I've implemented solutions using Javascript that enables users to add/remove rows to the item list. Let's keep it simple, we're creating new r...

Using ActiveRecord and Rails to insert Data into postgresql database get this error: RuntimeError: ERROR C22003 Minteger o

I am using Ruby 1.8.6 and rails 2.1.1 (I have tested rails 2.2.2 as well). I have been using Sqlite3 and I recently migrated to Postgresql 8.2.6 for production use. Now this error shows up. The interesting thing is that when I copy the insert statment and use psql to directly insert it into postgres it works fine. I guess the problem...

Get params inside a Ruby gem

It there a way to read the params inside a class of a gem I tried require "cgi" and require "action_pack" but no chance... Any clues ? Thanx ...

How to edit additional data in HABTM tables?

How do I update additional data in HABTM tables. For Example: I have movies, people and HABTM movies_people tables, but there is additional persontype_id field in movies_people table which indicates role of this person in that particular movie. How do I add/change this value? ...

Puzzled by Rails exception notification system.

[update2] One of those problems I solved & can't remember how... :) [update1] could this be a problem in the model? PAYPAL_CERT_PEM = File.read("#{Rails.root}/certs/paypal_cert.pem") APP_CERT_PEM = File.read("#{Rails.root}/certs/app_cert.pem") APP_KEY_PEM = File.read("#{Rails.root}/certs/app_key.pem") The page I'm trying to ac...

How do I add something to each route in Rails?

Is there an easy way to add a permanent string to every route in a Rails app, given that I already have quite a few resources specified and don't want to refactor all into a namespace? Can I do something along the lines of map.root 'myappnamehere' and have that string appended to the beginning of all routes? I realise that this is n...

How do you test HTTPS with Rails script/server?

I need to test HTTPS connections to my local Rails script/server instance in development it doesn't seem to be supported and I wasn't able to Google-up any solutions. Here's what it looks like from the client perspective: ted@teflon-ted ~/Downloads[master]$ grep tedslaptop /etc/hosts 127.0.0.1 api.tedslaptop.com ted@teflon-ted ~/Dow...

acts_as_solr returns all rows in the database when using the model as search query

In our application we're using acts_as_solr for search. Everything seems to be running smoothly except for the fact that using the model name as the search query returns every single row in the table. For example, let's say we have a users table. We specify acts_as_solr in our model to search the fields first name, last name and hand...

Best way to integrate a Rails app with a slow webservice

I need to implement a web client in a Rails app. The existing web service is SOAP and can often take several seconds to respond to requests. Using SOAP4R, the requests block. Is it acceptable to call these blocking methods directly from a rails controller? If not, should the rails controller buffer up commands with a separate service ...

Is there a self contained Ruby (and Rails) solution that can be run from a flash drive?

In the near future, I may be teaching a Ruby programming class to undergraduates at an art college. It's a safe assumption that the students have little to no experience with programming. The class will be taught in a computer lab, but they don't have any administrative rights on the lab computers. Ideally, I'd like the students to be ...

Subtle details after running rake rails:update

I upgraded a Rails application from 2.1.0 to 2.2.2 using rake rails:update. This updated config/boot.rb and the prototype and scriptaculous files on public/javascripts. Then I created two new Rails applications, one for each version of Rails. Comparing these two applications I noticed that there are more different files (production.rb,...

railroad balking on application model & admin level controllers

I've just installed railroad and tried to run a couple simple example runs. I have an application model and controller that are causing it some heartburn. There is no real application table - the model is used to load (include) things like the authenication system. The controller sets up the helper_methods, etc. I also have many contro...

Anyone know what CMS is using 37signals to manage the site?

I need to build simple site "one big page" like 37signals product's pages, and I was thinking about this. Anyone have an idea? are they using Radiant or coding manually? ...