Displaying 20 results from an estimated 8000 matches similar to: "file_field questions"
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
2005 Nov 17
1
original filename doesn't display in file_field
In my item upload view I have:
<%= file_field ''item'', ''file'' %>
and in my Item model:
def file
@file
#@file.original_filename # <- also tried this
end
def file=(file)
@file=file
end
And if the upload bails because of errors (and renders the same page), all other fields
(text_field, text_area, etc.) retain their inputted values, but the file
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 May 09
2
handling file upload onto local filesystem.
Hi,
I have a multipart form upload field uploaded through <%=
file_field("profile", "profile") %>
Once a submit happens, the action basically does something like:
profile = Profile.new(params["picture"])
This invokes the models = to method:
def picture=(picture_field)
...do a bunch of assignments here
end
def validate
... do a bunch of validations
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 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 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 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
2006 Jan 08
1
uploading an image to a Rails app
Hi,
I want to upload a product image to my rails app. I only want to store
the file name in the database and the actual image file in
public/image/. This seems complicated with file_field. Any pointers or
links with explainations?
Thanks,
Peter
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 Apr 27
3
LoginEngine File_column interop
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Hello all,
I hope someone can help me with this issue, I have the SVN
file_column and using LoginEngine/UserEngine with Rails 1.1.2. My
issue is that I''m overloading the view for LoginEngine to support a
file image upload as part of the user record and having a heck of a
time doing so.
Near the bottom of my new _edit.rhtml
2009 Oct 20
5
Annoying problem with file_field and paperclip
Hi all,
I have a really really annoying problem that''s driving me nuts with
file_field and paperclip and having to upload images everytime a form is
edited even though the user is quite happy with the currently uploaded
image or loose the previously uploaded image.
This seems to be caused by the rails file_field helper not storing the
data that has been read in from the db in the same
2006 Jan 15
4
file_field vs. file_field_tag
Hi,
The documentation doesn''t make it clear why both file_field and
file_field_tag are both useful. What is the reason for having two
instead of just one of these?
Thanks,
Peter
2006 Feb 03
6
Go back to previous action
Hello all!
I have two views (list_1 and list_2) that show a list of users in two
different ways. In the views for these actions there is a link to edit a
specific user properties (edit_user). That works fine, except that when
I change the user I want to go back to the view that originated the
request and not to the default list (list_1).
Can anyone help me?
Best regards,
Hugo
--
Posted via
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 23
1
Handling file uploads & mixing class and instance vars
Hey Everybody,
This is the only way I''ve been able to get my file
upload to work:
class Item < ActiveRecord::Base
def file=(upload)
@file=upload
end
def after_create
File.open("public/items/#{self.id}.jpg", "w") {
|f| f.write(@file.read) }
end
end
The upload form has "file_field ''item'', ''file'',
2006 Mar 04
13
file_column
Restricting size of an uploaded file, is how is that possible? If I
do not want a user to upload a file larger than X bytes, can it
easily be done?
If I also would like restrict the types of files that can be
uploaded, how may I do so?
Thank you,
Sharkie