similar to: Referencing exactly two models of the same kind

Displaying 20 results from an estimated 1100 matches similar to: "Referencing exactly two models of the same kind"

2006 May 29
1
Multiple Relations between 2 tables
So I am trying to figure out how I would go about creating the relationships between two tables, but there are multiple relationships happening. The one I am trying to figure out is a one_to_one relationship + a one_to_many relationship. Example: I have a home model and a location model home has_one location location has_many homes The trouble is I have to be able to access both
2006 Jan 05
13
Naming convention for foreign keys
Hi, In "Agilge Web Development With Rails" on page 217, an example of foreign keys is shown. I am however unable to find a definition of wheater the naming of the index is significant. On the above mentioned page, this line is shown in the example: constraint fk_items_product foreign key (product_id) references products(id) In "fk_items_product", "items" is
2012 Sep 21
4
Good resource for the history of activerecord association method naming?
Someone asked me about the history of the method naming in activerecord and I wasn''t sure where to point them. For example, there was early criticism noted of has_and_belongs_to_many in this old post from 2005: http://hans.fugal.net/blog/2005/10/03/habtm/ I was mentioning that many_to_many is not used because there are a few different ways of doing that via has_many :through and
2008 Sep 03
4
delta index in Sphinx
Hello, all! Help me please to solve problem with Sphinx and its delta index. Configuration file is located in attachment to this topic. ------------------------------------------------------------------- mysql> select id, e_mail from users where e_mail LIKE ''%test%''; -------------------------------------------------------------------
2008 Aug 24
11
link_to_function check javascript attribute
How could I check the value of an javascript object''s attribute? <div id="new_item_details" style="display:none"></div> <%= link_to_function("Show details...", nil, :id => "show_details") do |page| page.visual_effect(:toggle_blind, :new_item_details) if (page[:new_item_details].style.visibility ==
2008 Oct 03
7
form_remote_tag and :with
I am trying to pass the result from a javascript function along with the result from a text_field with form_remote_tag. This is what I have so far, but no go: <% form_remote_tag(:url => {:controller => ''requests'', :action => ''create''}, :with => "''data=''+request()", :update => ''request_sent'' )
2009 Jul 28
4
RJS-Template and link_to_remote
Hi, I am quite new to rails and can''t use any rjs-templates. The problem is, that he can''t use/find the methods in that template e.g. ''page'' or ''replace_html''. I get an error message on these methods. Here''s what I got so far in my example: Controller: ---- class AjaxTestController < ApplicationController layout
2009 Mar 10
5
'unknow column error' when using include and associated table condition in find
Here is my weird problem. Two models like following: Lexeme id:int name:string Structure id:int ref_id:string meta_id:int Lexeme can have many structure records through foreign key ''ref_id'' in the structures table. And these structure records belonging to one lexeme differs between each other using meta_id. And if Lexeme has structures, then there must be a top_struct whose
2008 May 07
2
Can I add a singleton action to @controller in a test?
All, I want to create a mock action to test a filter in a functional test, e.g.: # Simplified example def test_my_filter # Singleton action def @controller.foo assert # something end ActionController::Routing::Routes.draw do |map| map.connect '':controller/foo'', :action => ''foo'' end get :foo end My log files show that
2008 May 29
2
Render partial yields "dynamic constant assignment"
I''m getting a syntax error when rendering a partial. This is a simple html partial with one instance variable inside it. Rendering as a "template" instead of as a partial works just fine. The error occurs 3 lines after the last line of HTML code in the partial. There is no line 72! Here is the error: SyntaxError in Building_blocks#preview Showing
2008 May 07
2
Question on authenticity tokens
Does anyone find them useful? I can see them being good in some cases, but I have many exceptions that occur because of expired sessions. I am also not sure if they are really required for pages that require a login to access. The other place that they cause issues is in javascript requests. I am not using the built-in helpers, and all the javascript exists in separate js files. There is ways
2008 Jun 13
6
Newbie question on has_many
I have two classes: a Widget and a User. The User has an id that is referenced in two places on the Widget: owner_id and operator_id. How should I structure that reference for has_many? Thanks folks - I appreciate any help on this. --David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2009 Feb 02
2
ActiveRecord::AssociationTypeMismatch (User(#54754560) expected, got User(#54510280))
i keep getting this AssociationTypeMismatch error. i think this could be a bug related to ruby/rails when using mixins. heres a short version of my code: # user.rb require ''friend_invitation'' require ''friendship'' class User < ActiveRecord::Base include FriendInvitationUser, FriendshipUser ... end # friendship.rb ... module FriendshipUser def
2006 Apr 04
2
HABTM
Hi. Im new to Ruby and new to Ruby on Rails and have problems realizing a =20= simple many_to_many relationship: My tables: items <-> items_users <-> users ------------------------------------------------------------------------=20= -------------------------------------- id user_id = id name item_id name ... = password = ...... My Code: class
2008 Aug 24
3
tricky include question
I''ve been here before and maybe I''m trying to do something that is not possible. I am trying to include tables that are associated to other tables in the actual include statement but not to the original table call. In this case the furnii table. this is my original query @furnii_from_furnii = Furni.find :all, :include =>[:raider, {:imageasset => :skin}], :conditions =>
2010 Aug 01
0
fields_for can not group its params when ajax
hi book and page is one_to_many relationship.I want to create them in a single form.But when clicking create button,the submitted params for pages are not grouped correctly, i want "book"=>{"new_pages"=>[{"name"=>"", "color"=>""}, {"name"=>"","color"=>""}] but it is
2006 Apr 12
0
datamodell/databasestructure
Hi. I am trying to develop a small utility to manage inventories for outdoor-journeys At the moment I have the following tables to show a many_to_many- relationship between items(like tents/sleepingbags) and users: items <-> holdings(join) <-> users ------------------------------------------------------------------------ -------------------------------------- id user_id
2011 Jun 13
0
Nested Attributes Link / Save to An Existing Record
Happy Monday Everyone, Would you kindly help out a struggling nuby in solving this problem? I have been researching all over, yet to find a workable solution. Situation: A model [Announcement] that accepts nested attributes [Recipients] via many_to_many :through => :awards relationship. The Desired Outcome: #1. If a recipient''s email in the announcement form is not found in the
2005 Nov 29
6
draggable revert problem
Hello, I have tried implementing the shopping cart ajax example and have run into some problems. The only differences with the shopping cart is My list of products are generated from a partial view The images of the products come from an http link. However, Iam seeing a strange behavior when I drag and drop the elements to my cart. On the first drag and drop the image successfully reverts to
2006 Mar 12
2
new version of RTWindows, a scriptaculous window system
Hey, I uploaded the (probably) final version of RTWindows. It is far from perfect, but it does enough for me. Main problem is slowness, but that seems to be a general problem of draggables. Take a look at http://www.uni-weimar.de/~scheffl2/amsterdam/rtwindows_0.5/rtwindows.php -- Posted via http://www.ruby-forum.com/.