After cloning the latest stable versions of
rails (2.3.2),
rspec (1.2.2),
cucumber (0.2.0.4...came out 2009-03-24),
rspec-rails (1.2.2),
restful-authentication (fixed formatted_user_path and a few other problems),
webrat,
rubyist-aasm (and a few others)
into a clean rails application, and following (what I believe are) all the ins...
I changed my show controller to find records by their permalink rather than their id (for SEO juiciness).
def show
@project = Project.find_by_permalink(params[:id])
end
But, if I type in localhost:3000/projects/foo (and there is not a project with a foo permalink) I get a 500 server error instead of a 404 not found.
Why is this, an...
I am using polymorphic associations to track Comments in my project. All very straight forward stuff.
The problem I have is in querying based on the polymorphic association and joinging from the Comment model back to it's owner.
So ...
I have a Comment model
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic ...
I'm looking for guidelines on when to know when a RESTful approach to a model and it's associations is proper, and when it's not. Perhaps it's the nature of my current application, but I'm finding that simple models with no associations work well with REST, but complex models with many has_many assocations really seem to complicate the v...
I've been using vi/vim since '97 for various quick edits and
administration tasks, but have only recently considered using it to
replace Netbeans as my ruby editor of choice. One thing I find
extremely useful in both Netbeans and Eclipse is the Ctrl+Click "Go to
definition" feature, where you can ctrl+click on a class or method and
it wi...
I have a simple Rails app deployed on a 500 MB Slicehost VPN. I'm the only one who uses the app. When I run it on my laptop, it's fast enough. But the deployed version is insanely slow. It take 6 to 10 seconds to load the login screen.
I would like to find out why it's so slow. Is it my code? (Don't think so because it's much faster loc...
When you present a message to the user that involves an entity that could be either singular or plural, Rails has a shortcut to handle that. I'm talking about this situation:
"Delete committee? Its X meeting(s) will also be deleted."
Rails has a way so that "meeting" is presented as "meeting" or "meetings" depending on X.
I can't reme...
Is there anyway in which the scriptaculous autocompleter can be made faster?
Is there anything like a time property for which the autocompleter waits before sending out the suggestions?
...
Hello,
I'm thinking about an idea for something, as well as learning Ruby on Rails (easy eh :) ). I want something to allow a user to generate forms as templates, then assign these templates as forms in a location in a tree hierarchy, then allow users to fill in instances of these forms and save the data.
So, I've got two different t...
Hi, my Rails app works fine locally. But once I put it on a server and in production mode, I get this error:
ActionView::TemplateError (undefined method `each' for nil:NilClass) on line #7 of app/views/admin/confirm.rhtml:
4: <br>Description:
5: <br><%= @description %>
6: <br>Features:
7: <% @features.each do |feature| %>
8: <br><%...
I have a rails application that triggers Emails on certain events. These emails are sent to a separate company who will add some additional data to the email when replying. This is all understood and working, I am parsing the replies, extracting the data and it works fine.
I have now been asked to encrypt the emails.
Does anyone have a...
Hi does anyone know what this means? I only get this error when I app is deployed on a server and using PostgresQL. When I'm running locally and testing on SQLite, it is fine. I have a features_simulations join table, I think it is related to it somehow.
Processing AdminController#confirmed (for 211.30.107.155 at 2009-03-25 09:06:21) [G...
Is it possible to do something like this:
class SimulationController < ApplicationController
layout "generic", :only => [:login, :invalid]
layout "menubar", :except => [:login, :invalid]
For some reason, my login page still uses the menubar layout (I can tell because a menu bar will appear at the top). If I comment out the 3rd lin...
Hi,
Rails 2.3 was released last week and I installed it with gem install rails. Everything is working fine. However, I noticed a bug, so I searched a bit and sure enough a new commit was accepted 2 days ago that fixes the same bug I saw.
How can I get these latest changes into my version of rails that I'm running locally?
I trie...
What is the best way to persist the object's state to the database on a transition using aasm? I had thought that this would happen automatically but this doesn't seem to be the case.
(Edit: when I manually save the object, the state column does get updated. But a save isn't done on transitions.)
I can't find much useful documentation ...
I have a rails project where the the view displays a list of items. I use acts_as_list to make the list DnD orderable and in_place_editing on each item to, well, edit it.
My problem is that when I DnD the items around, the item I drag automagically becomes editable when I drop it. Any tips on how I can avoid that behavior.
Ideally,...
Hi Folks,
I'm new to Rails and working on a project where after the user logs in
they can click on a link to download an exe file ( say for example the
file is at http://test.com/test.exe). I want to keep the link to the exe
file hidden. What are the best ways to implement this step.
I was thinking about using the redirect to url but I...
I have a Service Types table containing id and name of a couple of dozen services.
I have a Projects table that has to have a list of Proposed Services, and a list of Accepted Services.
I know that I would use HABTM on both sides with a project_service_types table in between.
I can't quite figure out what to do when I have 2 different...
Hi guys,
I've been sending emails on my application (ruby 1.8.7, rails 2.3.2) like this
Thread.new{UserMailer.deliver_signup_notification(user)}
Since ruby use green threads, there's any performance advantage doing this, or I can just use
UserMailer.deliver_signup_notification(user)
?
Thanks
...
I have my json serialization working fine
render :json => "#{current_object.serialize(:json, :attributes => [:id, :name])}
But I also want to add further data to the json before it gets set back to the client. Mainly the auth_token.
Googled around like crazy but I can not find what option serialize will take to allow me to append/me...