ruby-on-rails

Install Ruby on Rails

How do i install Ruby on Rails in my PC ....can someone please let me know the files to be downloaded and installation procedures. ...

Ruby Application connect to database

I have created a sample Ruby Application. Now i would like to connect to a database and start working on it. Somebody please help me on the steps to follow. ...

Rails.root is Empty in Custom Rake Task in Rails 3.0

Maybe I missed this in the upgrade documentation, but if I output "Rails.root" in the rails console I see my app's root path. But if I reference "Rails.root" in a custom Rake task, it's empty. What am I missing? Thanks in advance. Sample: namespace :admin do desc "Import some data" task :import => :environment do csv = ...

resize image in ruby on rails using rmagick without losing quality

I need to resize an image in rmagick from its current size to a fixed width to a width of 300 without losing image quality. Currently I am doing following for a jpg image if previewImage.columns > 300 previewImage.change_geometry!("300x") { |cols, rows, img| img.resize!(cols, rows) } end am not sure if t...

Rails 3's Bundler can create 5 sets of file or folders -- should they be added to the project repo?

I think the 5 sets of files or folder the Rails 3's Bundler create are: Gemfile Gemfile.lock .bundle/config vendor/bundle vendor/cache Is there any more? For each of them, should they be added to the repository? Gemfile and Gemfile.lock, I think so, because that's what let everybody use the same version of gems. For .bundle/config...

How to you render JS.ERB files that is in another controller?

Hi folks, i do not quite understand what is wrong with my code - it is even causing my server to hang up. What i need to do is for the controller to return a JS script that when executed, will append a rendered partial to my $(".reviews") # test.html.erb $.getScript("/test"); # controller wants.js do render :partial => "/shared/...

Upload a WAV file with Paperclip and store both .wav and .mp3 versions

I have a Rails application where people can use an in browser sound editor to create wav files and upload them to the server. I use Paperclip for handling the sound file upload. I would like to be able to convert the wav file to an mp3, but keep both files. I have read about Paperclip processors, but I'm not sure how to use them to ge...

Temporary disable i18n fallback in Rails

I18n fallback is loaded: I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) Any idea now to temporary disable it? I have forms, where I want to edit various language versions, and with fallback I am getting fields with default language, if given translation is yet not present. ...

problem with rails instalation need 2.3.8 after installation still getting "rails -v" = "Rails 2.3.5"

I'm trying to setup clockingit but... even after gem install -v=2.3.8 rails 1 gem installed i'm getting rails -v Rails 2.3.5 I need 2.3.8 to rake the gems for clockingit help greatly apreciated ...

Ruby on Rails Time.now

Hi, I'm having trouble working with Time.now. For some reason when I save an object to the DB it saves it for the year 2000. I'm trying to make a comparison to the object I saved in the DB to Time.now to check if it is greater, but it always returns false because of the year 2000. Does anyone know of a way I can work around this? I jus...

Rails 3 Admin Namespace Issue

Hello Stack, I'm migrating the majority of my application to the admin namespace and while there are lots of guides related to this, I still can't manage. I've been primarily following this answer, along with any results Google brings up (they all tend to agree). Could somebody please tell me what I'm doing wrong so I don't lose any mor...

Apache Bench and POST data

i am trying to use apache bench to load test a create action in my rails application but ab doesn't appear to be sending the POST data - though it does correctly submit a POST and not a GET request. this is the command i run: ab -n 1 -p post -v 4 "http://oz01.zappos.net/registrations" and this is the contents of the post file: authe...

How do you generate a new Rakefile for a Rails app that has "lost" its Rakefile?

Somehow my Rails app doesn't have a Rakefile. I don't know if it lost it or what. So when I run: rake gems:refresh_specs I get: No Rakefile found How do I generate a new Rakefile to refresh my gem specs? ...

Problems With Simple captcha.

I have a weird issue .I am using simple captcha in forms in my rails applications. If I am using one captcha in a web page I don't have any problem. But I have a scenario of using three(3) forms in one page in which all the three forms will have the captcha . So that when I refresh the page the captcha data of the three forms are equal....

is there a nicer/rails-like way for find all where something IS NOT NULL query?

is there a nicer/rails-like way for this IS NOT NULL query? MyModel.find(:all, :conditions=>"some_reference_id IS NOT NULL") ...

Task.find Conditions

Hi, I'm building my first Rails project - its a ToDo app, which are supposed to send out warnings when a Task are X minutes from its deadline. Im trying to create a variabel with the tasks that are X minutes from its deadline. The X minutes are diffrent for every Task - which means that its stored in the database. So I got two columns ...

how do I create a virtual jquery filetree?

Hi, I would like to create something like this using ruby on rails. Im not tied to jquery but it seems like this his what I want: http://labs.abeautifulsite.net/projects/js/jquery/fileTree/demo/ The issue is I want to build the tree not based on a file system, but based on ruby code which pulls info from various models. In other words...

Rails: How to chain scope queries with OR instead of AND ?

I'm using Rails3, ActiveRecord Just wondering how can I chain the scopes with OR statements rather than AND. e.g. Person.where(:name => "John").where(:lastname => "Smith") That normally returns name = 'John' AND lastname = 'Smith', but I'd like: name = 'John' OR lastname = 'Smith' ...

What are the best practices to generate "widgetized" content in Rails

On my previous projects built with usage of Zend Framework I extensively used Zend_view's "Action View" helper. It basically allows to initiate a separate cycle of request->dispatch ti action->view_rendering from a view script. Here is the link to an appropriate page of zend framework reference guide (search for "Action View Helper"). ...

Missing RedCloth gem but `rake gems:install` does nothing

I tried starting my Rails application but got this error message from Passenger: Ruby on Rails application could not be started The application has exited during startup (i.e. during the evaluation of config/environment.rb) /home/chuck/chuck.com/vendor/rails/railties/lib/rails/gem_dependency.rb:119: Warning: Gem::Dependency#version_...