ruby-on-rails

Has Many Through Association Polymorphic Error

With Rails 3 out I was wondering if there was some new way of doing a has_many :through association with a polymorphic model? If not what is the best way of doing it? Here's what I'm working with class Page < ActiveRecord::Base end class Text < ActiveRecord::Base end class Picture < ActiveRecord::Base end Text and pictures are cont...

Should I create two different sets of 'category' models? Ruby on Rails.

Hello, I have two models on the Rails app that I am working on, Article and Profile. I want them to have separate sets of categories. Should I create two different category models? article_category and profile_category? There will be lots of redundant code if I do this. ...

Rails 3 Rspec Error - SQLite3::SQLException: no such column: comments.article_id

I am trying to test for a comment deletion using Rspec. I think my test is wrong because when I try to delete a comment in my browser, it works. Here is the Rspec test that I am running: before(:each) do @admin = Factory(:user, :admin => true) @user = Factory(:user, :email => "[email protected]") @article = Factory(:arti...

help with this Rails code, plz (select and javascript)

hi guys, this is what I wanna do. i need to have a select with options and javascript in each one, **select...%>** <% @buscar.each do |j|%> <option value="<%= j.cedula_tutor1 %>" onclick="Datos2('j.cedula_tutor1');"> <%= j.cedula_tutor1 %> </option> <%end%> **</select>** this is what I has made in rails... <%=select("cedula_tuto...

ACTIVESCAFFOLD: Display column hidden by conditions

Adding conditions to an activescaffold hides the column that the condition is on. For example, I have an 'is_active' column on an embedded scaffold. If I set the condition to include ':is_active => true', the is_active column does not show. I would like this column to continue to show even with the condition. So, for example, my ...

Will searchlogic work with Rails 3?

If not what are my alternatives? ...

What's the latest version of Rails 2.3.x?

rubyforge is out-dated. When can I get the latest version number of Rails 2.3.x? I'd like to use 2.3.x for a while before upgrading to latest 3.x of Rails. ...

rails handling single and multiple returned objects

In rails you can use .each do || to loop through the returned results of a query. But what if only one line is returned? or you have the possibility of 0, 1, or many? how do you handle these scenarios without throwing an error? This situation in particular is one where i am accepting nested attributes following ryan's railcast blog (htt...

Uses of Ruby on Rails

I am a somewhat experienced rubyist, but I am now starting to do rails development. I know rails is used to make "web applications" but what exactly does that mean? Do you build entire sites with rails or do you build a feature for a website in rails, and integrate it in to an existing website? (I know this question is kind of vague, but...

Using Radio Buttons in Rails

Hello, I have a Category model with two booleans, article_cat? and profile_cat?. I want to be able to create a new Category with a form that lists these two using radio buttons. If one radio button is marked, the other one is unmarked. It should send a true value to the create method of the one that is checked and create a new category w...

Is it possible to uninstall ruby gems, rails etc and do a complete clean install?

I seem to be having issues with gems and want to start with a fresh install. Is this possible without reinstalling Snow Leopard from scratch? Thanks in advance, Galen ...

Defining minoccurs and max occurs in WSDL using rails

I have generated WSDL with complex types using action webservice in rails. Now I need to add minoccurs and maxoccurs in complex type definitions using ruby on rails Defined complex type in API file(SampleApi.rb). Any suggestions on adding min and maxoccurs? ...

Paperclip to upload images to S3 in Rails. The files upload at a very slow rate. A work-around?

I'm working on a rails app where the user will be uploading large quantities of images. My current setup: Using SWFUpload to upload multiple files at once using the Paperclip plugin with S3 storage. After the original image is uploaded to S3, Delayed_Job is used for the post processing (thumbnails, etc). The problem I have is that the...

PHP for an OpenStreetMap Application

Hi! I'm doing a project using OpenStreetMap and OpenLayers. Currently, my task is to insert the data from the OSM file that I have to a PostgreSQL. When I checked out Osmosis (the tool for transferring data from the OSM file to the database), it says there that, in one example, "Import a planet file into a local PostgreSQL rails port dat...

Use authlogic to find the User record based on an associated record

Typically, with Authlogic, you would authenticate with some unique identifier (e.g. email or username) and a password. Authlogic does this by first finding the record by the identifier (User.find_by_email_address(email) or similar), then calling then .authenticate method on the returned object, which checks the password against the recor...

File upload issue in Rails 2.3.5 using paperclip

I have a Rails 2.3.5 application which has a file upload functionality using paperclip. When I upload a file first time everything works fine. But the second time I try I get the following error message uninitialized constant ActiveSupport::MessageVerifier::Encoding From the trace it looks like an issue with form_authenticity_token....

Rails' datetime and timestamp in a migration file are the same for MySQL and Sqlite3?

:datetime and :timestamp in a migration file seems like the same in MySQL and Sqlite3, and they both map to datetime in the database side, except I can't find that in a formal documentation. Also, what about when if our Rails project may use other DBMS, then should we use :datetime or :timestamp when we script/generate (or rails generat...

ROR Newbie question about form_for error

I am new to ROR, i follow this tutorial to learn ROR,however, it show a error on <%= form_for([@post, @post.comments.build]) do |f| %> <%= f.error_messages %> <div class="field"> <%= f.label :commenter %> <br/> <%= f.text_field :commenter %> </div> <div class="field"> <%= f.label :body %> <br/> <%= f.text_area :b...

Handling file uploads in Rails 3

I had a working code for Rails 2 to handle file uploads that no longer works with Rails 3. The code is: # Handling file uploads def file=(file_data) unless file_data.blank? @file_data = file_data self.filename = file_data.original_filename self.size_before = file_data.size end end Now Rails 3 doesn't like that, complai...

Rails Restful Routing and Subdomains.

Hi I wondered if there were any plugins or methods which allow me to convert resource routes which allow me to place the controller name as a subdomain. Examples: map.resources :users map.resource :account map.resources :blog ... example.com/users/mark example.com/account example.com/blog/subject example.com/blog/subject/edit ... #b...