ruby-on-rails

Rails with DB2 and multiple schemas

I have a 'legacy' DB2 database that has many other applications and users. Trying to experiment with a rails app. Got everything working great with the ibm_db driver. Problem is that I have some tables like schema1.products, schema1.sales and other tables like schema2.employees and schema2.payroll. In the ibm_db adapter connectio...

Rails Google Maps integration Javascript problem

update I Based on feedback, I've changed var maps to var adds. problem description I'm working on Rails 3.0.0.beta2, following Advanced Rails Recipes "Recipe #32, Mark locations on a Google Map" and I hit a road block: I do not see a google map. My @adds view uses @adds.to_json to connect the google maps api with my model. My databas...

How to display image pointed by URL in Rails

HI, I have a image here http://power.itp.ac.cn/~jmyang/funny/fun4.jpg and I want to display it in my Rails site. How should i do that? EDIT: Well, guys , I understand the downvotes now. It is because it is too naive a qeustions:) Sorry, I know almost nothing about HTML tags before asking the question but thanks to Rails, even that I t...

check_box_tag and find condition

<%= check_box_tag('videos_count')%> If this box is checked, the param will say "videos_count"=>"1" . In the controller I have this: videos_count = params[:videos_count] @cars = Car.paginate( :page => params[:page], :per_page => 10, :conditions => ["videos_count = ?", videos_count], when the box ...

Set rails request timeout (execution expired)

Should be an easy one but google isn't helping: can't find a way to get rails to wait longer before a request expires Error is: ActionView::Template::Error (execution expired) ...

Problem testing a plugin with 2 diff versions of rails installed on the system

Hi, I have some unit tests for a plugin I have written. This plugin is attached to a sample rails application. Both the rails application and the plugin is configured for rails 2.2.2. So far my system had ruby 1.8.7 with rails 2.2.2 and I faced NO issues running the unit tests in my plugin or the tests of my sample rails app. Just a c...

relative_url_root error while upgrading rails

I'm upgrading a rails app 2.1 to 2.3.5. After upgrading i got the error in the views undefined method `relative_url_root' for #<ActionController> any suggestions?? ...

Implementing Role based Helpers

So my question is how would you implement your handwritten Helpers based on the role of current user. Would it be efficient to change the behaviour at request time? e.g. the Helper somehow figures out the role of user, and include the proper SubModule? module ApplicationHelper module LoggedInHelper # Some functions end ...

How to avoid nginx+passenger logging each request two times

I have nginx(0.7.64) with passenger(2.2.9) over ruby(1.8.7) Enterprise Edition. When I operate from script/console, log behaves normal, but whenever nginx receives a request, it is logged twice. I have two different rails apps in separate vhosts (like the one bellow) and it happens in both (one is in development and one in production)....

Rails Paperclip XML POST File

I am able to 'POST' to a Rails application (with Paperclip) using XML instead of the standard web form (trying to do it from another Ruby script). However, I would like to include a binary file. Is there any way to include the binary data within an XML tag? Or can I do something like B64 encode the data on the client and then decode...

Is there any way to hook the "controller" generator so it runs "rspec_controller"?

I want to make it so I can just type script/generate controller and it will run script/generate rspec_controller. How can I do this? ...

rake task via cron problem loading rubygems

I have managed to get a cron job to run a rake task by doing the following: cd /home/myusername/approotlocation/ && /usr/bin/rake sendnewsletter RAILS_ENV=development i have checked with which ruby and which rake to make sure the paths are correct (from bash) the job looks like it wants to run as i get the following email from the cr...

Rails form multiple params XML

I have a form (snippet) <% form_for(@transfer, :html => {:multipart => true}) do |f| %> <p> <%= f.label :source %><br /> <%= f.text_field :source %> </p> <p> <%= f.label :destination %><br /> <%= f.text_field :destination %> </p> <% fields_for :upload do |u| %> <p> <%= u.label :upload %><br /> ...

Rails RJS template displays code instead of the html page

After having Googled and hurting my brain for hours on this, I finally decided to post this question. Here's the code... view1.html.erb -------------- <%=link_to_remote_redbox "Link", :url => {:action => :action1, :id => @some.id} some_controller.rb ------------------ def action1 render :layout => false end def action2 do some p...

i18n redirection breaks my tests ....

I have a big application covered by more than a thousand tests via rspec. We just made the choice to redirect any page like : / /foo /foo/4/bar/34 ... TO : /en /en/foo /fr/foo/4/bar/34 .... So I made a before filter in application.rb like so : if params[:locale].blank? headers["Status"] = "301 Moved Permanently" redirect_to ...

Ruby on rails with differnt user types

Hi everyone, Im trying to build a application that has different kinds of users, Im using authlogic for user authentication. So I have one user model that has the required field for authlogic to do its magic. I now want to add a couple of different models that would describe the extra fields for the different kinds of users. Lets say ...

Rails - Any plugins for building a online quiz/test?

Hello guys, I'm trying to add some online tests to my site and before I rolled up my sleeves I was wondering if there is any ruby on rails plugin support for such a task. Essentially I'm looking for something that lets me add multiple choice questions. Performing the scoring logic would be an added bonus. Any one know of anything? ...

Rails Facebooker image_submit_tag

I have a typical form_for for registering user. But in the end I would like to have an option to submit data with fb_login_button. So I could save user's (manually entered) data as well as data that facebook sends me in one swing. Is that possible? If not, can I get user's facebook data wihout redirecting to new page? ...

How does Facebook codes their Cropping tool?

I ask this because I am currently trying to work out my own technique, and there are huge strategic hangups for the entire site when your begin this. Of them are: Using jCrop and rMagick, it takes up a huge amount of processing ( to which I have backgrounded ). Because I have it backgrounded, I must by ajax develop a feature that auto-...

Rails - Searching multiple textboxes and fields

I have a model of events that has various information such as date, location, and description of whats going on. I would like for my users to be able to search through the events list through a set of different textboxes but I having a hard time getting the syntax just right in my view I have... <% form_tag users_path, :method => 'get...