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...
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.
...
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...
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...
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 ...
If not what are my alternatives?
...
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.
...
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...
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...
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...
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
...
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?
...
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...
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...
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...
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....
: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...
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...
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...
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...