ruby-on-rails

Similar thing to RJS (used in Ruby on Rails) in the Java web app world ?

In Ruby on Rails, there's RJS templates that help do AJAX by returning javascript code that will be executed in the client browser. How can I do a similar thing in the Java/J2EE world? Is Google Widget Toolkit similar to RJS? What options do I have? ...

SQLite3::BusyException

Running a rails site right now using SQLite3. About once every 500 requests or so, I get a ActiveRecord::StatementInvalid (SQLite3::BusyException: database is locked:... What's the way to fix this that would be minimally invasive to my code? I'm using SQLLite at the moment because you can store the DB in source control which makes ba...

Which Rails plug in is best for role based permissions? (Please provide one nomination per answer)

I need to add role based permissions to my Rails application, and am wondering what the best plugins out there are to look into. I am currently using the RESTful authentication plugin to handle user authentication. Why is the plug in you suggest better than the other ones out there? ...

Setting environment variables for Phusion Passenger applications

I've set up Passenger in development (Mac OS X) and it works flawlessly. The only problem came later: now I have a custom GEM_HOME path and ImageMagick binaries installed in "/usr/local". I can put them in one of the shell rc files that get sourced and this solves the environment variables for processes spawned from the console; but what...

Ruby/Rails Collection to Collection

I have a two tables joined with a join table - this is just pseudo code: Library Book LibraryBooks What I need to do is if i have the id of a library, i want to get all the libraries that all the books that this library has are in. So if i have Library 1, and Library 1 has books A and B in them, and books A and B are in Libraries 1, ...

ActiveRecord#save_only_valid_attributes

Hello, I'm looking for a variation on the #save method that will only save attributes that do not have errors attached to them. So a model can be updated without being valid overall, and this will still prevent saving invalid data to the database. By "valid attributes", I mean those attributes that give nil when calling @model_insta...

Overriding "find" in ActiveRecord the DRY way

I have a few models that need to have custom find conditions placed on them. For example, if I have a Contact model, every time Contact.find is called, I want to restrict the contacts returned that only belong to the Account in use. I found this via Google (which I've customized a little): def self.find(*args) with_scope(:find => { ...

in Rails, how do I execute direct SQL code on a different database?

Here is the case. I'm writing a Rails application which will monitor data quality over some specific databases. In order to do that, I need to be able to execute direct SQL queries over these databases - which of course are not the same as the one used to drive the Rails application models. In short, this means I can't use the trick of ...

In Rails, What's the Best Way to Get Autocomplete that Shows Names but Uses IDs?

I want to have a text box that the user can type in that shows an Ajax-populated list of my model's names, and then when the user selects one I want the HTML to save the model's ID, and use that when the form is submitted. I've been poking at the auto_complete plugin that got excised in Rails 2, but it seems to have no inkling that this...

Rails or Grails?

Grails vs Rails. Which has better support? And which one is a better choice to develop medium size apps with? Most importantly which one has more plug-ins? ...

How to start facebook app?

Just want to know what is better way to get start developing faccebook app?Any tutorial recommnedation?And which is better to start up -php or rails? ...

What is the best way of speccing plugins with RSpec?

I'm creating a plugin, and am looking to use RSpec so I can build it using BDD. Is there a recommended method of doing this? ...

Removing static file cachebusting in rails

I have a rails application which is still showing the cachebusting numeric string at the end of the URL for static mode, even though I have put it into the production environment. Can someone tell me what config option I need to set to prevent this behaviour ...

Interacting with Outlook appointments using rails

Hi, I have a rails application running on a Linux server. I would like to interact with Outlook/Exchange 2003 appointments from the rails application. For example, certain actions should trigger sending an appointment, and then preferably accepting/canceling the appointment in Outlook should trigger events in the application. Failing t...

Mixing ActiveRecord find Conditions

I want to find records on a combination of created_on >= some date AND name IN some list of names. For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names. Is there a way to combine the two? ...

Rails books?

Hey ya guys ...do you know good books for ruby on rails .I know 'Grails'.Keeping that in mind please suggest some good books for Rails ! ...

Getting a full list of the URLS in a rails application

How do I get a a complete list of all the urls that my rails application could generate? I don't want the routes that I get get form rake routes, instead I want to get the actul URLs corrosponding to all the dynmically generated pages in my application... Is this even possible? (Background: I'm doing this because I want a complete li...

What is the best method for storing SASS generated CSS in your application and souce control?

If you are using HAML and SASS in your Rails application, then any templates you define in public/stylesheet/*.sass will be compiled into *.css stylesheets. From your code, you use stylesheet_link_tag to pull in the asset by name without having to worry about the extension. Many people dislike storing generated code or compiled code in...

Best Permalinking for Rails

What do you think is the best way to create SEO friendly URLs (dynamically) in Rails? ...

How can I "Pretty" format my JSON output in Ruby on Rails?

I would like my JSON output in Ruby on Rails to be "pretty" or nicely formatted. Right now, I call the to_json method and my JSON is all on one line. At times this can be difficult to see if there is a problem in the JSON output stream. Is there way to configure or a method to make my JSON "pretty" or nicely formatted in RoR? Thanks....