ruby-on-rails

Quick and easy Slicehost slices

Can anyone point me to an article with the best way to quickly setup a Slicehost slice with Rails/Git from scratch? ...

File storage in Heroku - alternatives?

I have an app in Heroku and love its simplicity, however, I need simple file storage for uploaded images (using file_column). As I see it, my options are to migrate over to Slicehost or get the Heroku app working with Amazon S3 (I'm a bit perplexed by the S3 pricing scheme). Are there other alternatives? ...

How can I view HTTP requests being sent through a rails application?

I'm trying to interface with a 3rd party website, and the communication goes as follows. Send this request POST /Service/LabelService.asmx/GetLabelXML HTTP/1.1 Host: www.host.com Content-Type: application/x-www-form-urlencoded Content-Length: length labelRequestXML=<LabelRequest> ... </LabelRequest> Receive this response HTTP/1.1 ...

Sorting ActiveRecord models by sub-model attributes?

Lets assume I have a model Category which has_many Items. Now, I'd like to present a table of Categories sorted on various attributes of Items. For example, have the category with the highest priced item at the top. Or sort the categories based on their best rated item. Or sort the categories based on the most recent item (i.e., the cate...

Writing an ActiveRecord adapter

I'd like to write my own ActiveRecord adapter for the HBase database since none currently exist. However, I've been searching for a while online and can't find any good resources on how to write an ActiveRecord adapter. How would you go about doing this, or are there any links you can recommend? ...

Web application backend - confused with options

I'm looking to start on a project web 2.0 app for a bit of fun. I'm a little confused as to what sort of backend I will require. The site revolves around a user submitting an item, then other users submitting responses, then rating each response up or down. That sounds a little like digg.com I realise. How do I go about tackling a projec...

Find related tags using acts_as_taggable

I am having trouble using find_related_tags with an :any and :all option and can't find any working examples. Without the :all option find_related_tags returns all fields in the array that I am providing, ideally it would only return tags that are related to all fields in the array. ...

Rails 2.3.2 trying to render ERB instead of HAML

Rails is suddenly trying to render ERB instead of Haml and I can't figure out why. I've created new rails projects, reinstalled Haml, and reinstalled Rails. Here's exactly the steps I take when making my application (Rails 2.3.2): rails> rails test rails> cd test rails\test> haml --rails . rails\test> ruby script\generate model...

online mp3 player

Hi i'm looking for a piece of software that'll allow me to play mp3's from my webserver though a simple web app. support for playlists would be nice ,but non-manditory, though a shuffle funtion is a must. I can run php, ruby, or python apps on my server, and woudl prefer something free or open source (as long as the price is nominal thou...

How can you send a file to S3 after all processing is done using paperclip in rails?

I have a rails app with Video and Image models. Both use SWFUpload for progress indication feedback and queued uploading. So they are uploaded to a TempImage, and TempVideo model then when the ActiveRecord Video and Image models are saved the temps are moved over. On the images the different styles are created with the default paperc...

initializing and incrementing a variable in one line of code

Is this the DRYest way to do it in ruby? <% for item in @items %> <%= n = n + 1 rescue n = 1 %> <% end %> which initializes "n" to '1" and increments it as the loop progresses (and prints it out) since this is in one my app's views ...

How do you send plaintext instead of HTML email from Rails?

I'd like to send plain text emails from a Rails app. In my mail sending config I have: ActionMailer::Base.default_content_type = 'text/plain' Nonetheless, when I send a test email from the Rails console, I get: >> GeneralAppMailer.deliver_test # ... Content-Type: text/html; charset=utf-8 And looking at it in Gmail, it does seem t...

Why does my RJS stop working when I set options in form_remote_for?

I am running into a strange problem. I simply want to display a loading icon on the page when pressing a button. If my call to form_remote_for contains Ajax options then the RJS script does not work. This works ("loading" is hidden by the controller and RJS): View: <%=form_remote_for(:job, @job, {:url => {:action=>:create}}) do |f...

Returning from rails controller

Hi, As a follow up for this question http://stackoverflow.com/questions/968799/returning-from-rails-controller how can I return false. I need to call the controller function to check for an ID. If the ID exists I need to return true. else return false to return true, I am using : {render :nothing => true, :status => :ok} thank yo...

Rails, trouble in a form trying to use the put http method

<% form_ tag user_path(@user), :method => :put do %> That's my form, so I want it to access the update method of my UsersController, I set the map.resources :users , and the RESTful paths generated: users GET /users(.:format) {:action=>"index", :controller=>"users"} POST /users(.:format) {:a...

How do you get libcurl libraries to work with InstantRails?

I'm working on a windows machine and trying to get the curb plugin to work, first thing I realized was I needed the curl library installed on my machine, so that's what I'm looking to do. I simply downloaded a curl library, a curllib library, and have them located at c:/curl and c:/curllib respectively. I setup my environmental variabl...

AJAX Rails Validation

I have my form and validation working great with regular http requests. I would like it to use AJAX. I know i can validate on the client side but that seems redundant given that I have defined the validations in my model. As the user is filling out the form, I'd like to give feedback to them on their entries. What is the best way to ...

Is this RESTful?

I have a Rails app that needs to expose values from a database as a web service - since I'm using Rails 2.x, I'm going with REST (or at least try). Assuming my resource is Bananas, for which I want to expose several sub-characteristics, consider this: - /banana -> give a summary of the first 10 bananas, in full (all characteri...

Best Rails Tagging Plugin/Gem

Hello, what plugin or gem do you recommened for tagging? There are many of them, acts_as_taggable, acts_as_taggable_on_steroids, acts_as_taggable_on,... What do you say? ...

Installing SQLite3 on Windows - what's the current easiest route?

Am brand new to Ruby looking to get Redmine to run on WinServer08 sp1 I've read a few threads here detailing the steps and workarounds required to get Ruby and SQLite to play nice with each other. Ruby will run...sqlite3's .dll and api are in the specified directories...i've rebooted but rake -test fails. I'd like to find out if ther...