Displaying 20 results from an estimated 10000 matches similar to: "Override has_many :order at run-time?"
2006 Jun 23
2
polymorphic challenge
Hello All,
I have a little challenge and I am not sure if this is even possible
I am working on a dating/event site and few functionalities are similar
that I want to centralize them.
We have users which can have
- favorite users
- interest list
- blocked users
All these relations are like;
User <-> Relation <-> User
I was thinking I could have a class called Relation (with a
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 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 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 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 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 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?
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 Feb 13
2
categories and admin/categories - different controllers and templates?
Is there some way to have these two sets of URLs use
totally different controllers and templates?
categories/list
categories/show/1
admin/categories/list
admin/categories/edit/1
admin/categories/destroy/1
admin/categories/update/1
Besides, of course, using different controller names
;). The first URL is publicly accessible, while the
second contains admin functions. Also, with the
second,
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 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 Jan 30
2
Finding grandchildren with has_many?
I have a table hierarchy like so:
sites->items->comments
I''d like to be able to do this in templates:
<% for comment in @site.comments.find(:all, order=>''timestamp desc'') %>
I''ve tried all the various permutations of ''has_many'' in site.rb I can
think of, but can''t get it to work. I''m not even sure if
2005 Dec 14
3
image upload (apache2.0+ lighttpd)
Hello all,
I use lighttpd 1.4.8 and I have a problem with image uploads.
I tried file_upload plugin, but it is strangely working sometimes and
refuse to work sometimes.
Function in the controller is (@user is loaded in before_filter)
def update_watermark
@user.watermark = params[:user][:watermark]
@user.save
redirect_to :action => "index"
end
Model is
2005 Dec 24
3
Avoiding HABTM field clobbering?
>From the docs:
"Note that any fields in the join table will override
matching field names in the two joined tables. As a
consequence, having an "id" field in the join table
usually has the undesirable result of clobbering the
"id" fields in either of the other two tables."
I do have an ID field in the join table, and as a
result it''s clobbering the ID
2006 Apr 15
7
New to rails - scaffold command , how to get related items?
Ahoy,
I was able to follow the tutorials and build a simple to-do list program
with Items and Categories and have the related tables link up w/ the
default "scaffold :Items" command plus custom defenitions.
Then I erased all of that and tried rebuilding the program using the
ruby script/generate scaffold Item (and category) command.
Now the templates look like
"
<% for
2006 Jan 10
3
Serving lots of images to only registred users
Hello guys,
I am building a photo website and I have some questions before I really
start programming the site.
My system will be Debian + lighttpd + mysql +fastcgi + ImageMagick
I plan to use file_column for image handling/verification and thumbnail
creation.
My question is;
I need to store images in a place outside of webroot so only registered
members can see them. To serve them secure