similar to: Help with tricky object relations

Displaying 20 results from an estimated 9000 matches similar to: "Help with tricky object relations"

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 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 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 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 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 Jan 22
2
Rails and Apache: Error
I''ve done my development using WEBrick, and now I want to put my application on a server that uses Apache. (not with fcgi) I think I''ve done everything like I''m supposed to, but when surfing to my site I get: Application error Rails application failed to start properly" In /var/log/apache/error_log, I get this error:
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 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 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 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 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 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 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 23
3
Newbie: ''find'' across multiple relationships
For security purposes, I often want to find objects that are ''visible''. e.g. class Person < ActiveRecord::Base has_many :x end ... @person.x.find(params[:id]) as opposed to X.find([params[:id]). Simple enough for me. My question: Say we have - class Person < ActiveRecord::Base has_many :x, :class_name ''Z'', .... has_many :y, :class_name
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 Mar 14
2
Two unsaved related objects
Given the two tables Parent, Child where Parent has_many children: If I don''t save parent first then it seems that child.parent will not be assigned automatically if I call parent.children << child . Must the parent record be saved before I call parent.children << child ? If I must save Parent first then can someone explain to me how I can call parent.valid? before it
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 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 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 08
5
object.save is not creating an insert statement
I have a model for a task class. When I try to save a task, for some reason no INSERT statement is being generated. Here''s the pertinent part of the development.log: ------------------------------------ Processing TasksController#create_fromProject (for 70.247.24.238 at 2006-03-08 14:20:30) [POST] Parameters: {"commit"=>"Create",