I'm having a hard time figuring out how Firefox and Chrome determining what fields are for a password and how they autocomplete them on other forms.
For my login form, I have this:
<p>
<label for="login_email">Email:</label><br />
<input id="login_email" name="login[email]" size="30" type="text">
</p>
<p>
<label for="login...
I'm building a Ruby on Rails app where people are clicking on addresses. When they click, I want to display a small google map of the address in a frame (I want to use a frame/iframe so when they scroll down to look at more addresses, the little map won't scroll off too.) I'm having a hard time finding examples or discussions of this. I ...
I've seen "RJS" and "RJS templates" mentioned in passing in blog posts and tutorials. I did a search, but I'm still unsure about it. Is it a technology specific to Rails, rather than a standard like JSON or YAML?
I understand it's used for "generating JavaScript." Does it generate generic JS or Rails-specific JS requiring the Prototype ...
I have two different methods that I want to execute when a user clicks a button. I have them working separately, but when I try to combine the two I get errors. The two ones I have currently are
<%= image_tag('go_button.png',
:id => "search_go_button",
:class => "search_go_button",
...
I'm having significant trouble installing Ruby on Rails.
I installed Ruby with apt-get When I tried installing Ruby Gems, the installer consistently hung indefinitely on installing ri, so I tried installing Ruby from source instead. I had the same problem, so I installed Ruby Gems without ri or RDoc. I don't know if this is relevant to...
I have this showing up all over in my controllers:
if not session[:admin]
flash[:notice] = "You don't have the rights to do #{:action}."
redirect_to :action=>:index
return
end
And its sibling:
if not session[:user] and not session[:admin]
flash[:notice] = "You don't have the rights to do #{:action}."
redirect_to :action=>:i...
I am trying to write a rails application which lets you go to a certain page, say /person/:id. On this page it shows a set of available resources. I want each resource to have a button next to it, which reserves that resource to that person (by creating a new instance of an Allocation model.) As an extension, I'd like several buttons by ...
I have to run a Web server with many services on an embedded server with limited RAM (1 GB, no swap). There will be a maximum of 100 users. I will have services such as a forum, little games (javascript or flash), etc.
My team knows Ruby on Rails very well, but I am a bit worried about Rails' memory usage. I really do not want to sta...
How can I configure the rails logger to output its log strings in another format? I would like to get something that is more informative like:
[Log Level] [Time] [Message]
Debug : 01-20-2008 13:11:03.00 : Method Called
This would really help me when I want to tail my development.log for messages that only come from a certain log level...
I've written a content management system that uses a server-side regular expression to escape ampersands in the page response just prior to it being sent to the client's browser. The regular expression is mindful of ampersands that have already been escaped or are part of an HTML entity. For example, the following:
a amp; d, © 20...
We're using RSpec and Cucumber in our Rails apps with good results. Webrat is great for non-AJAX interactions, but we're getting ready to get back into writing tests for our Javascript.
Webrat has Selenium support built in, and we've used Selenium before, but I'm curious if anyone has had good results using Watir with Cucumber and what ...
I have a Apache + Haproxy + Mongrel Cluster setup. I want to receive alerts whenever my Mongrel queue length gets too high.
How to I get the current Mongrel Queue length and make it available for alerting tools such as Monit and Nagios?
I know that Haproxy has the information about Mongrel queue as it intelligently sends requests to l...
In the past I've used RailsForum.com as a resource, but lately I've come across far too much spam and not enough useful posting. Certainly just my perspective.
So, what do you Rails developers use as a forum resource for the platform?
...
I'm wondering if someone has already built a system for threaded comments (for lack of a better term) in Rails or if I need to build it myself.
In case it's not clear, what I'm referring to is a comment system like Reddit's that automatically indents replies so that they appear like branches of a tree (preferably with voting just as Re...
We've got a rails app that keeps producing an error that we can't track down. The problem seems to lie with the routing but we're not sure what is happening. Out routes file looks like:
ActionController::Routing::Routes.draw do |map|
# Default
map.home '', :controller => "home"
# Admin
map.admin_home 'admin', :controller => 'a...
I wrote the code below which doesn't seem to work, but If I delete the
last if statement, it does work, obviously for the first two use cases
only. Is there a better way to write this code? In my routes file I have
map.resources :galleries
map.resources :users, :has_many => :galleries
A user clicks on the link "galleries" and see a li...
I have the following controller action and test. I'm new to testing with Shoulda and I know there are areas of my controller that I can test further. For example, my flash messages as well as verifying the renders.
So my question is, how would I properly test this controller action in Shoulda?
My controller action (names have been ch...
I have the following ActiveRecord classes:
class User < ActiveRecord::Base
cattr_accessor :current_user
has_many :batch_records
end
class BatchRecord < ActiveRecord::Base
belongs_to :user
named_scope :current_user, lambda {
{ :conditions => { :user_id => User.current_user && User.current_user.id } }
}
end
and I'm tryin...
In Rails you can use nested routes to create RESTful routes for has_one and has_many relationships. Examples can be found on the Rails Guides
I'd like to ask if there is a good way to configure RESTful routes for habtm relationships? For example if I have a relationship A-habtm-B, my idea is to configure nested routes for A has_many B, ...
For some reason I can't save a Time to MySQL. My Column is a datetime and I've also tried using a timestamp when I was testing. Here's my console session below:
$ ./script/console
Loading development environment (Rails 2.1.0)
>> Event.find 1
# Event id: 1, name: "Meeting at XXX", start_date: "2009-01-17"
>> e.start_date = Time.now
=> T...