Displaying 20 results from an estimated 900 matches similar to: "polymorphic challenge"
2006 Mar 22
5
foreach item in column
Hi there,
I have a database with phonenumbers, and I want to make a function
that runs a command for each of these numbers, with the number as an
argument
Something like this in Perl:
system("/bin/command $number");
mysql> select * from numbers where list = "one"
+----+----------+----------+---------------------+-----------+
| id | number | name | email
2006 Jun 18
10
acts_as_enumerated
Hello All,
Any one using acts_as_enumerated? I need help using (I like that it
caches values in memory)
I am working on a dating website and there are lots of options I want to
store as enumerated like
Status; divorce, single,
Sex: male, female
Eye color; blue, brown, green....
and lots more....
But I do not wanna keep them in seperate tables, and wanna keep them all
together.
Anyone has a
2006 Apr 25
3
limiting options in file_upload
Does anyone know if it''s possible to set constraints to the size & type of file that file_column will accept?
I''d like to limit to image files of less than 2MB.
If this isn''t possible with file_column, is there a graceful way of getting the controller to handle it?
thanks
dorian
--
--
I do things for love or money
2006 Jan 26
4
Override has_many :order at run-time?
Is it possible to override has_many''s :order attribute at run-time? e.g.
something like:
<% for category in @site.categories(:order=>''name'') %>
...
<% for category in @site.categories(:order=>''rank'') %>
...
thanks
csn
--
Posted via http://www.ruby-forum.com/.
2006 Jan 20
8
validates_confirmation_of not working
is there any special requirement for validates_confirmation_of ? I am
trying to make sure 2 passwords are equal (cleanly the rails way)..
In my view i have two fields with id user[password] and
user[password_confirmation].
in the model i have
validates_confirmation_of :password, :message =>"Passwords do not match "
Am i missing something here ?
thanks
adam
2006 Jun 07
2
Qick Q: Expression in this Controller
I tried putting this inside my controller:
def goodbye
@link = Link_to "goodbye!", :action =>"goodbye"
end
and display it in my views calling the @link variable.
Of course it doesn''t work.
Why?
Thanks
--
Posted via http://www.ruby-forum.com/.
2006 Mar 22
3
Problems with validates_presence_of...anybody?
Hello everybody,
I have been developing small applications in Rails from quite some time.
But lately, I came across a bug which I have not been able to correct.
If anybody could help me with it, would be of great help thankyou.
Actually, the problem is that I have a form in my application with some
set of fields.
Now what "validates_presence_of" should do is that if I submit the form
2006 Apr 01
4
Saving images in shared directory w/ Capistrano/SVN?
Hi all,
I''m using Capistrano and SVN to version control and deploy, but I''m not
sure what to do about my images directory. I use file_column and
RMagick to save images to the disk under a model called "Image", and
they''re saved in public/image/... etc.
Each time I deploy a new version, my image folder doesn''t exist anymore.
I don''t want
2006 Apr 30
4
Subversion and Capistrano
I have a project under Subversion, deployed by Capistrano.
When it is deployed, obviously I need to deploy "real" copies of
database.yml, deploy.rb, and maybe a couple of other files.
But if I offer it for public checkout, I obviously do not want these
files as part of the checked out code.
What''s the best way to handle this?
--Al Evans
--
Posted via
2006 Jan 19
4
validates_presence_of
I am just going through the book and I come across a problem with the
code in the app/models:
validates_format_of :image_url,
:with => %r{^http:.+\.(gif|jpg|png)$}i,
:message => "must be a URL for a GIF, JPG, or PNG image"
It seems to moan when it''s empty even though I removed :image_url from
validates_presence_of. How should I make it optional?
2007 Jul 11
7
Best way to upload an image and make a thumbnail
Hi, which is the best way to upload an image, keep that and also make a
thumbnail?
The images should not be stored in the database, but as normal image
files in a specific directory.
I think that for the thumbnail i should use rmagick, but for the upload
? (something which work with and without javascript, in every browser)
Thanks :)
--
Posted via http://www.ruby-forum.com/.
2006 Jun 13
2
securing a file
Hi,
I want to allow the downloading of specific file only to authorized
user,
lets say an MPEG.
where do I start? ;-)
Thx,
Dor.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 30
2
RJS and variables help...
How can I get mt RJS template to accept a variable as the ID value?
Doing this works:
page.replace_html ''1'', "some text..."
This does not:
page.replace_html @employee.id, "some text..."
Looked and searched but little documentation at the mo especially in
RDocs.
--
Posted via http://www.ruby-forum.com/.
2006 Apr 25
6
SQL WHERE equivalent in rails
What is the equivalent of the WHERE SQL condition in rails?
I''m thinkin this could be something like:
<% for product in @products where category="1" %>
but obviously the syntax is wrong.
--
Posted via http://www.ruby-forum.com/.
2006 Jan 23
3
Clearing a file_column-type field
So I am now able to set/upload an image to my app using file_column,
with a little bit of a change to the code.
I can change the image using an Edit page, but I''m trying to figure out
what to do if the user wants to remove the image. I tried adding a
Remove Image link in my list, but I''m not sure what to do in the
remove_image method in my controller. I tried setting the
2006 Jan 30
10
How to hide port number from URL?
I just installed RoR on my server and I can access it using port 3000,
but it''s not very nice to have it in the URL. How can I hide the port
from the URL?
Thanks,
--
Posted via http://www.ruby-forum.com/.
2006 Aug 10
0
polymorphic challenge
Hello guys,
I have 2 classes (I pasted small part of them here);
class Shop < ActiveRecord::Base
has_many :items, :as=> :itemable
protected
def self.paying_scope
with_scope(:find => {:conditions => ''expires_on > NOW()'', :include
=> [:address]}) do
yield
end
end
end
class Item < ActiveRecord::Base
belongs_to :itemable,
2006 May 28
7
Self-referential has_many :through relationship
Hi,
I have a self-referential has_many :through relationship setup to
track relationships between users. Basically relationships are
modeled as a join table with an extra column ''relation''.
create table relationships (
user_id integer unsigned not null,
friend_id integer unsigned not null,
relation char(1) not null,
)
--- relations ---
f = friend
r = request to
2000 Feb 17
2
Problems building host keys on some SPARCs
Hi,
I've compiled openssh 1.2.2 on Solaris 7/SPARC. On most hosts, things
are fine. I get EGD going, compile openssh, and I can then generate
hostkeys as described in the INSTALL file to get things running.
On a few hosts though, the keygen fails like this:
root at sylow:/source/USR_LOCAL/OFFICIAL/OPENSSH/ssh_client# ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N ''
ksh:
2006 Jun 25
7
Unicode HOWTO?
I am disappointed about the (seeming) lack of Unicode support in Rails.
Is there a howto about working the most important limitations? For
example, figuring out the length of an entered word: "???".length() will
return 6, not 3. So if there is a maximum number of characters a user is
allowed to enter, this won''t work as it should -- it treats strings as
byte arrays instead