Displaying 20 results from an estimated 9000 matches similar to: "Newbie: ''find'' across multiple relationships"
2006 Feb 22
9
acts_as_habtm_list plugin
I''d like to announce acts_as_habtm_list plugin for rails.
acts_as_habtm_list is a Ruby on Rails plugin, that can manage ordered
lists through a join-table. It is providing almost the same Api as
acts_as_list. The position column has to be defined in the join table.
You can find additional information at:
http://www.inlet-media.de/acts_as_habtm_list/
Install it executing this command
2006 Mar 22
10
Need for multiple acts_as_list
I have a model "Childmodel" that belongs_to two other models "Parent1"
and "Parent2". "Parent1" "has_many :childmodels, :order => :positionp1"
and "Parent2" "has_many :childmodels, :order => :positionp2". i.e. The
child is independently positioned within each of its parents.
This works fine and gets me the useful
2006 Mar 01
2
Find non-empty association?
I have two models, Category and Article. Article belongs_to :category
and Category has_many :articles. I''d like to be able to find all
non-empty categories. What''s the best way to do that?
Pat
2006 Mar 14
3
Help doing find - look for nonempty habtm
I''ve got a Cuisine and a Restaurant model, with a habtm. One thing I
want to do is find all the cuisines that have at least one restaurant
associated with them. Right now I''m using the following SQL query:
SELECT DISTINCT(cuisines.*) FROM cuisines, restaurants,
cuisines_restaurants WHERE cuisines.id =
cuisines_restaurants.cuisine_id AND restaurants.id =
2006 Mar 04
4
Submitting data to two different tables with two different models
I''m very new to Rails. I''ve been reading Agile Web Dev for a while and read
up on ruby, but I''m still learning.
I designed a website for someone for an engineering shop. New projects had
to be added manually.
Well, I figured this would be a great canidate for railifying! I have the
form working perfectly, you can add your data and get it in a table, and
listing
2006 Mar 16
4
Table Relationships Problems.
I have the following tables setup:
locations
:id
:name
systemmessages
:id
:name
systemmessage_validtimes
:id
:name
:systemmessage_id
:location_id
:start
:end
The systemmessage_validtimes has a ''has_many'' relationship with
systemmessages, meaning that there could be many valid times for each
system message.
@systemMessage = Systemmessage.find(1)
E.g. I
2006 Jan 16
3
routing to controller inside module
Hey,
am i to stupid to find the information about how to route to a
controller in a module? Maybe module support has gone!
The controller is under:
app/controllers/admin/my_controller.rb
The my_controller.rb file looks like this:
module Admin
class MyController
def index
render :text => ''Hello!''
end
end
end
How does a route to all controllers under module
2006 Mar 08
3
List and update values from text_field_tag fields
Hi,
I populate a couple of text_field_tag''s with data from an AciveRecord
object. Some fields are editable and at the end of the page there''s a
submit button. I want the new values to be updated in the DB but by
default my original values are stored again.
How do i go about doing this?
thanks/jens
AIM: jens.tinfors@mac.com
Skype: jtinfors
2006 Mar 15
4
help with DRY violation
I''m trying to be a good rails developer and fix DRY violations as i find
them. However, i''m trying to fix this one, i cant seem to get it to work.
I have two tables A and B that have a one-to-one relationship. Table B
belongs_to Table A. Table A has_one Table B. I''m creating instances of
Table A in different places, depending on the controller. However, for each
2006 Apr 13
2
Rail''s basic idea
Hallo,
what links would you recommend for an advanced programmer, who wants to
know something about the basic idea and architecture of Rails.
That''s no question for tutorials or howtos, but rather for theoretical
documents and field reports.
Can you help me?
--
Norman Timmler
http://blog.inlet-media.de
2006 Mar 13
3
validates_associated problem
Hello,
I have a situation where an ''employee'' belongs to a ''department'' and
have setup the relationship as follows.
class Employee < ActiveRecord::Base
belongs_to :department, :foregin_key => "department_id"
validates_associated :department_id
end
class Department < ActiveRecord::Base
has_many :employees
def validate_on_update
2006 Mar 24
19
Storing images in Ruby
Hi,
I''d like to allow users to upload images and store those images in a
Postgres database. I''ve looked through the example in "aguile
development with rails" which suggests using the MySQL blob field.
When I wrote a similar app in Java, we Base64 encoded the file and then
stored it as a text field. Is this easy to do in RoR too? Any advice you
can give me would
2006 Mar 21
13
Double and single quote usage in AWDWR
Hello everyone!
I''ve noticed, that the book uses double quotes almost everywhere. It is like
<%= javascript_include_tag "prototype" %>
I''ve checked the "programming ruby, 2ed" book and found that double
quotes are most suited when escape sequences and substitutions are
required. Isn''t it more semantically correct to write this code like
2006 Feb 28
6
Log Files in View
Is it possible to display the log files in the view?
Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 03
3
embedding a forum inside a rails app
what is the best way to embed a forum (phpbb is currently installed under
/public/forums/) inside my layout ? I dont want the foum to be its own page
i would like it to appear inside the main part of the page with navigation
and border in tact. is this possible with the current way it is installed ?
thanks
adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Mar 14
8
email address parse
hi all
how to parse such email string to a array:
#--------------------------------------------
"joe black"<joe_1@joe_black.com> joe_2@joe_black.com,
joe_3@joe_black.com
#--------------------------------------------
seems emails from user input include various format. and i have to
split them to a array.
any idea?
regards.
--
Posted via http://www.ruby-forum.com/.
2006 Mar 02
3
Custom SQL Question
Hello,
can search with following SQL Statement:
def execute_search
@result = Search.find_by_sql ["SELECT * FROM customers WHERE
firstname LIKE ? LIMIT 10",params[:firstname]]
render :template => "search/resultlist", :layout => false
end
My question is, how do I use 2 or more Parameters - and with the "%"? (I
Like to use SQL-Statements because
2006 Mar 05
5
A nicer and gentler form of spawner
I was working on deploying an app with switchtower, and I really
dislike the way spawner is implemented. The way it will relaunch the
dispatcher all the time just to let it die if the port is in use is
too brute force for my taste.
As we''re in a ruby script, why not let ruby find out if the port is in
use? Using the TCPServer class we can try and bing to the port. If we
succeed, it means
2006 Feb 15
2
Ruby install tips
---------- Forwarded message ----------
From: Luciano Broussal <luciano.broussal@gmail.com>
Date: Feb 15, 2006 5:00 PM
Subject: [Rails]
To: rails@lists.rubyonrails.org
Hi all,
Is anybody know how + to install a ruby application (persitent , after
computer restart) in the system tray.
Is any body know an installer to package ruby application and to compile it
as an file .exe
Thank you all
2006 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project