Displaying 20 results from an estimated 6000 matches similar to: "Dates entered as MM/DD/YY"
2006 Feb 11
6
Rails Edge, has_many :through in searches
I have two tables, a Projects table and a Clients table.
It''s basically a HABTM relationship, but I have additional project/
client-specific information in the join table. I''m trying to use the
new has_many :through method to join these. It works fine when
displaying records, but when I try to search, I''m having this problem:
When I used a HABTM model to search
2006 Jan 09
7
Large select list, speed issues
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">I have a piece of code in my page
to generate
2006 Jan 09
3
Custom flash[:notice]
For the most part, my
flash[:notice] messages fall into one of two categories: either a
message stating that something happened successfully (which is colored
green), or messages showing errors (which I would like to be red).
Is it possible to set some sort of flag on these messages to choose
which color I want to show, or would I need to base it on CSS and set
the class in the text, i.e.
2006 Mar 30
4
ActionMailer e-mails getting tagged as junk in Outlook 2003
Whenever an email is sent via ActionMailer, and the recipient is using
Outlook 2003 (with SP2 installed), the e-mail is getting put in the junk
e-mail folder. Since Outlook doesn''t give a reason it was tagged as
junk, it''s hard to determine what to change.
I''ve compared the message headers of the "junk" mail and a valid email
sent through Outlook, and the
2006 Feb 03
3
Breakpointer not working
When I try to run script/breakpointer, I get the following error:
/usr/local/lib/ruby/1.8/drb/drb.rb:837:in `getaddrinfo'': getnameinfo:
Non-recoverable failure in name resolution (SocketError)
It''s Rails 1.0 on OSX 10.4.4. Any suggestions?
2006 Jun 05
3
How to get dd mmm and yyyy from dd-mmm-yyyy
The input values could be something like this:
01-Dec-2006
01-December-2006
1-June-2006
Is there an easy to way to get the three variables populated dd, mmm and
yyyy for any of the above input values? I tried to look at regex but couldn''
anything simple.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jan 22
2
File_column not keeping value during page reloads
I''m trying to use the file_column plug-in to attach a file to a
newsletter posting. It works fine if I get the form right the first
time, but if I get an error, such as not typing in a required field, and
the form re-displays, my file selection box reverts to "no file selected."
Here''s my relevant controller code:
def new
@newsletterpost = Newsletterpost.new
2006 Feb 28
5
Getting number of days in a month
In PHP, there was an argument you could pass to the Date function to
get the number of days in the current month:
echo date("t"); // Outputs "28" for February
I don''t see anything like this in Ruby/Rails. Right now, I''m using a
very ugly line to pull the last day of the month:
@number_of_days = (Date.strptime(Date.today.strftime("%Y-%m-01"))
2006 Jan 09
6
Nil column results, possible to ignore?
For a table "clients" there are city, state, and zip fields. However, for some clients we only have a state with no actual address.
The following code throws a "You have a nil object" error when outputting my client list. Is there a way around this, short of writing a specific case for each possibility?
<%= client.city + '', '' + client.state +
2006 Jan 19
2
select vs. select_tag
I have a "Users" object and
a "Timesheets" object. Each timesheet entry belongs to a User, which is
selected from a drop-down list. The timesheet has a user_id field. (The
user needs to have an option to select a different user due to the way
our system works.)
If i use the "select" object, which is bound to the Timesheet model,
using this code:
<%= select
2008 Apr 04
5
First call to worker method doesn''t work
I have a worker as follows:
class SampleWorker < BackgrounDRb::MetaWorker
set_worker_name :sample_worker
def create(args = nil)
# this method is called, when worker is loaded for the first time
end
def my_method
# Deliver test e-mail message
Notifications.deliver_message(1, "DM")
end
end
I have a rails controller that calls the following code:
worker =
2005 Dec 30
3
Select SUM(?) Query
When using PHP, I was able to
enter a query against my list of invoices such as :
Select SUM(amount) from invoices where project="123"
This would give me the total amount of all invoices for project 123.
In rails, how would I do this? I tried using "find_by_sql," but
couldn''t figure out how to extract the results out of this. Thanks!
2006 Jul 26
8
change text_field_tag class
in my booking / _form I have the following input fields : (startdate and
endate)
<div>
<label for="startdate">Booking Start Date</label><br />
<%= text_field_tag(''startdate'', @startdate, {:class => @startdateclass,
:readonly => "readonly", :maxlength => "25"} ) %>
<%= observe_field("startdate",
2006 Jan 21
4
Single quotes in parameters
I have a "search" action for my "projects" controller, which defines a
set of projects as follows
@projects = Project.find(:all, :include => [:user,:clients], :conditions
=> "name like ''%" + params[:query] + "%''",:order => ''number'')
This works fine, until I type an entry into my search box that has a
single
2006 Feb 10
1
Eager loading issue
I have three tables, Invoices, Projects, and Managers.
Each manager has many projects. Each project has many invoices.
When displaying a list of the invoices, I am using:
Invoice.find(:all, :include => [:project])
Since the list shows information from the project table. (For
example, a table showing Invoice Date, Project Name). However, I''d
also like to show the manager name.
2006 Jan 22
1
file_field questions
A couple questions about file_field elements.
First, with code such as this:
<%= file_field ''attachments'', ''filename'' %>
Would the filename of the file I select be the value that''s stored
within the database under the "filename" column, and then I would just
add in code in my "create" controller to upload the actual file?
2006 Jan 08
1
Options_from_collection_for_select -> Multiple fields in display
The following code shows a list of
the users, with username being each person''s initials (mine would be
DM).
<%= options_from_collection_for_select @users,"id","username" %>
However, I''d like to have the display of the SELECT box be "DM - Dylan
Markow" instead of "DM." Is this possible using
2010 Aug 18
2
RSpec 2/Rails 3 - content_for in view specs
My main layout includes separate content_for/yield sections for my header,
sidebar, footer, and content. However, when running a view spec, the
`rendered` variable seems to only contain a string of just the primary
content and ignores the header/footer/sidebar as well as the rest of my
layout file (the "render" call just returns my primary content wrapped in
generic <html> and
2005 Dec 29
2
options_for_select order
I''m trying to create a Select box
using the following code:
<%= select ''project'', ''status'', { "Active" => "Active", "MD"
=> "MD", "HOLD" => "HOLD", "Dead" => "Dead" } %>
You''d think the select box would keep them in
2006 Apr 19
4
RJS replace_html auto-closing tags
I''m using the following RJS template to spit out a div containing a
list of projects:
page.replace_html ''results'', ''<div>''
@projects.each do |p|
page.insert_html :bottom, ''results'', p.name + "<br/>"
end
page.insert_html :bottom, ''searchresults'', ''</div>''
page.show