ruby-on-rails

Why do I have problems running script/x tasks after installing rails 3 beta?

I installed rails 3 beta in my OSX Leopard. After that, I've created a rails project to test it. From inside its folder, I just can't do script/generate, or even script/server. It returns '-bash: script/server: No such file or directory'. How could I resolve this issue? ...

What production-ready SaaS (recurring billing) solutions are available for Rails?

I am working on a software-as-a-service (SaaS) application and I am looking for a billing plugin of some sort that will manage my subscriptions, customers, and recurring billing. There is the RailsKits SaaS kit ($249.00), but I prefer to use open source software. I have also found maccman's saasy, but the phrase "At the moment this is al...

Having problems using haml and rails3

After installing rails3, I'm experiencing problems when trying to use haml with it. I have the updated gem installed, and after rails PROJECT_NAME , I did haml --rails in its root. It apparently had worked fine, since I have haml folder inside plugins, init.rb, as expected. But when I try to rake, or rails server, I get: rake aborted...

Uploading file is not working

I have done the following form <% form_for @anexo, :url => {:action => "create"}, :html => {:multpart => true} do |f| %> <%= f.error_messages %> <p> <%= f.label :descricao, "Descrição"%> <%= f.text_field :descricao %> </p> <p> <%= f.label :arquivo_anexo, "Arquivo Anexo" %> <%= f.file_field :arquivo_anexo %> </p> <p> <%= f.submit ...

Rails - Add style/image to button_to

I'm developing in rails right now and I was wondering if there are any easy ways to add some style to the button_to control. Can you add styling to the <%= submit_tag 'Log in' %> or <%= button_to "Show Me", {:controller => 'personal', :action => "add" } %> It would be great to change the color....But brownie point if someone can...

What OpenId plugin/gem shall I use for my Rails application?

There are so many plugins/gems but must of them have outdated documentation or no documentation at all. From what I have seen there are the Rails openid, Eastmedia openid, Authlogic openid, rails kit openid plugins and from a gem search we have rails_openid, pelle-ruby-openid, rack-openid, openid_auth, openid_fu_generator, openid_login...

Testing a scoped find in a Rails controller with RSpec

I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutio...

Running tasks in the background with lower CPU priority

I have a feature in my CMS that allows a user to upload a zip file full of images and the server will extract them and insert each one into an image gallery. I've noticed that this grinds up the CPU quite severely and causes other requests to slow down. I'm thinking of using the delayed_job plugin to delegate each image addition into th...

Sorting deeply nested attributes in Rails

I want to be able to drag and drag App model which is nested under Category model. http://railscasts.com/episodes/196-nested-model-form-part-1 Here's the Railscast I've tried to follow. #Category controller def move params[:apps].each_with_index do |id, index| Category.last.apps.update(['position=?', index+1], ['id=?', Cate...

is there mysql corelib site for building queries?

Maybe i have the wrong context but... Is there a corelib site for mysql like http://corelib.rubyonrails.org/ for ruby on rails RoR? Would be nice to have 1 stop shop. thx. ...

Ruby on rails: Image downloads with Authentication/Authorization/Time outs

Hi Guys, I'm having few doubts on implementing file downloads. I'm creating an app where I use attachment_fu with Amazon s3 to upload files. Things are working pretty well so far on uploading side. Now its the time to start the file downloads. Here is what I need, a logged in user search and browse for Images and they should able to add ...

Rails: Accessing the username/password used for HTTP Basic Auth?

I'm building a basic API where user information can be retrieved after that user's login and password are correctly sent. Right now I'm using something like this: http://foo:[email protected]/api/user.xml So, what I need to do is access the user/password sent in the request (the foo and bar) but am not sure how to access that info in a ...

Getting types of the attributes in an ActiveRecord object

I would like to know if it is possible to get the types (as known by AR - eg in the migration script and database) programmatically (I know the data exists in there somewhere). For example, I can deal with all the attribute names: ar.attribute_names.each { |name| puts name } .attributes just returns a mapping of the names to thei...

MD5 wrong number of arguments (1 for 0) Error

Hi All, I have following error on my Server which is working properly on my local on following line . event_id = MD5.new("event-init-flash-#{Asteroid::now}").to_s #line 232 ERROR: wrong number of arguments (1 for 0) /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:232:in `initialize' /ruby/gems/gems/shooting_sta...

How to run the rails console in debug mode in Aptana Radrails.

In Apatana Rad Rails, I want to run the rails console in debug mode. When I launch the debugger as shown below, debugger doesn't honor the break points. debug script/console I am able to run the rake tasks in debug mode by giving a similar command, i.e. debug rake db:migrate Any pointers will be highly appreciated. ...

Ruby on Rails deployment, on "thin" server with lot of attachments

A lot of PDFs are stored inside MySQL as a BLOB field for each PDF file. The average file size is 500K each. The Rails app will stream the :binary data as file downloads, where there is a user click on the download link. Assume there is a maximum of 5 users downloading 5 PDFs concurrently, what kind of deployment setup parameters I sh...

Rails routing problem

I am new to Rails routing and I currently have a problem and hope someone can explain it to me. I am using Rails 2.3.5 Firstly, let me describe my working-fine code: I have a text example, which has a controller (cars_controller) with an update action (along with some other actions). The update action needs the :id parameter. The edit....

Modeling Buyers & Sellers in a Rails Ecommerce App

I'm building a Rails app that has Etsy.com style functionality. In other words, it's like a mall. There are many buyers and many sellers. I'm torn about how to model the sellers. Key facts: There won't be many sellers. Perhaps less than 20 sellers in total. There will be many buyers. Hopefully many thousands :) I already have...

what if html_escape would stop escaping '&'?

Hi, is there any danger if the rails html_escape function would stop escaping '&'? I tested a few cases and it doesn't seem to create any problems. Can you give me a contrary an example? Thanks. ...

Download all image or create zip file of all uploads from the gallary contained uploads

I am on the photo sharing site , and i want to give functionality to download all the images available in the gallery ,, I have taken gallery in a relation where i can get all the iamges by @gallery.uploads , Now what i want is to download this all files , or if its possible to create any zipfile so that we can download that one file co...