ruby-on-rails

RoR on Windows with Mongrel

Where is the best tutorial for getting RoR working on a windows box with Mongrel? I'm a complete novice at server management, so the more detailed the better! ...

How do I close a popup window, and open the next page in the main window in ROR?

I have a popup window containing a form which gathers data for a report. When I click submit in that window, I want it to close the popup, and open the report in the original window that called the popup. I think I can open the report in the correct window by using { :target => } in the form_tag, but I don't know how to determine ...

How do I set the name of a window in ROR?

How do I "name" a browser window in ROR, such that I can open a page in it later, from another (popup) window (using the target="name" html parameter) ...

How can I count the number of records that have a unique value in a particular field in ROR?

I have a record set that includes a date field, and want to determine how many unique dates are represented in the record set. Something like: Record.find(:all).date.unique.count but of course, that doesn't seem to work. ...

How do you actually read source code?

Reading source code is a good way to improve as a programmer, but I've never seen a great explanation of how to do it. We often read textbooks & novels linearly, perhaps taking notes along the way. What do you do when trying to understand how a program works? Try the user-facing version of the program with your own inputs Read the API ...

Integrating InstantRails with Aptana or any other IDE

So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails? ...

Strange Rails Authentication Issue

I'm using the RESTful authentication Rails plugin for an app I'm developing. I'm having a strange issue I can't get to the bottom of. Essentially, the first time I log into the app after a period of inactivity (the app is deployed in production, but only being used by me), I will be brought to a 404 page, but if I go back to the home pag...

Running DB Migrations from application

I have a rails application where each user has a separate database (taking Joel Spolsky's advice on this). I want to run DB migrations from the rails application to create a new database and tables for this user. What is the easiest way to do this? Maybe db migrations is not the best for this type of thing. Thanks! ...

What's the best way to use SOAP with Ruby?

A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked into soap4r, but it see...

Can Ruby convert an acts_as_nested_set to a JSON hash cleanly without recursion?

Is there a fast and clean way of returning a JSON hash back from any node in a Ruby on Rails' acts_as_nested_set without using recursion? Here's the recursive solution for reference: class Node < ActiveRecord::Base has_many :products def json_hash if children.size > 0 children.collect { |node| { node.name => node.json_has...

Rails - recovering database from Production.log

Hello, We recently lost a database and I want to recover the data from de Production.log. Every request is logged like this: Processing ChamadosController#create (for XXX.XXX.XXX.40 at 2008-07-30 11:07:30) [POST] Session ID: 74c865cefa0fdd96b4e4422497b828f9 Parameters: {"commit"=>"Gravar", "action"=>"create", "funcionario"=>"6" .....

What's main differences between "new" ASP.NET MVC framework and typical Java Struts projects ?

I'm more a Java developer than a .Net guy but It seems to me that new Microsoft MVC's framework seems like typical combination of Java existing projects like : Struts (for handling the MVC), Hibernate (for object to SQL mapping, like LINQ), and URL rewriting to handle pretty URLs (that's less common). Also, It seems to me very simila...

Database sharding and Rails

What's the best way to deal with a sharded database in Rails? Should the sharding be handled at the application layer, the active record layer, the database driver layer, a proxy layer, or something else altogether? What are the pros and cons of each? ...

How Do I Test Rails Logging In from the Console?

I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here. app.get '/' assert_response :success app.get '/auth_only_url' assert_response 302 user = User.find(:user_to_login) app.post '/signin_url', ...

Adding Functionality to Rails

I'm working on a Rails app and am looking to include some functionality from an earlier question I asked here. However, I'm having problems getting it to work. I was under the impression that I should just make a file in the lib directory, so I named it 'get_ip.rb', with the contents: require 'socket' module GetIP def local_ip or...

How do I implement an OpenID server in Rails?

I see a similar question for Ubuntu, but I'm interested in hosting my own OpenID provider through my Rails-based site that already has an identity and authentication system in place. Note that I'm not looking for the delegate method to use the site as an OpenID. What's the best way to do this properly? ...

What's the best way to pass data into a Flex chart from a Ruby on Rails application?

Quite a few methods exist for passing data into a Flex binary from a Rails application. Right now, I'm using the old e4x resultFormat with a xml.erb template. I've done AMF before, but I feel like inlining parameters into the embed itself is a better solution because you don't have to wait for the browser to load a swf binary and the b...

How do I do full-text searching in Ruby on Rails?

I would like to do full-text searching of data in my Ruby on Rails application. What options exist? ...

How can I upsert a bunch of ActiveRecord objects and relationships in Rails?

I am working with an API that provides bus arrival data. For every request, I get back (among other things) a list of which routes serve the stop in question. For example, if the list includes result for bus route #1, 2, and 5, then I know that those serve this stop. I have a many-to-many relationship set up between Route and Stop, and ...

Best Ruby on Rails social networking framework

I'm planning on creating a social networking + MP3 lecture downloading / browsing / commenting / discovery website using Ruby on Rails. Partially for fun and also as a means to learn some Ruby on Rails. I'm looking for a social networking framework that I can use as a basis for my site. I don't want to re-invent the wheel. Searching th...