similar to: has many ( THROUGH ) confusion

Displaying 20 results from an estimated 1500 matches similar to: "has many ( THROUGH ) confusion"

2006 May 13
4
somewhat advanced question about mysql
so here is the deal. i''ve got three tables: lists, items, comments, and this is how they are laid out: lists table id title items table id list_id item comments table id list_id comment to give you some background. in order to get a list of all the lists i am making this call: SELECT lists.id, title, count(items.list_id) AS total_list_items FROM lists INNER JOIN
2012 Aug 08
1
Creating ToDo List App
Hi, New Rails user here trying to create a basic todolist app in rails 3.2.6 and running into some foreign key issues. Here''s what I did... I generated scaffolds list title:string & task description:text listname:string Next, in order to link the listname for Tasks and the list titles in the Lists I generated a migration file which looks like this class AddListIdToTasks <
2006 Jul 02
6
remote form w/ evalScripts:true
Hello. I want to select an item from a select list and have that result in an ajax call that updates two sections on the page. Here is the code in the controller def create ... render :update do |page| page.replace_html ''list_items'', :partial => ''lists/list_items'' page.replace_html ''add_item'', :partial =>
2007 Jan 05
2
Using RESTful routes in controller tests
Why can''t I use the RESTful route helpers in my specs? In my controller I''m doing a redirect: redirect_to list_path(:id => @item.list_id) Now when I write: controller.should_redirect_to list_path(:id => 2) I''m getting the following error: NoMethodError in ''POST on /lists/2/items should redirect to index on succesful POST'' You have a nil object
2006 Sep 10
5
why isn't :order working in acts_as_list
Ok, I''m sure this has to be something stupid that I''m doing (or not doing), but I can''t seem to get things to order by the specified column. class List < ActiveRecord::Base has_many :list_items, :order => "orderby" The error I get back when trying to save the link is: Unknown column ''position'' in ''order clause'':
2006 Sep 28
15
Inserting rows into linking table
Hi, I have two objects: Contacts Lists I want to be able to add multiple contacts to multiple lists. I''ve created a linking table and a form that allows me to select the contacts using checkboxes, but I''m having some problems with the controller and model. I receive the following error message when I submit the form: Mysql::Error: Cannot add or update a child row: a
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come in. Console just gives me back :account_id => nil. Obviously I''m trying to set it though. Silly console... But, I can set the account_id column in my controller like so: @user = User.new(params[:user]) @user.account_id = account.id @user.save Here''s what I give to the controller: User.create :name
2006 Jun 19
3
Using set_primary_key breaks acts_as_tree with non-integer column
I just switched from using the standard "id" column into using my own primary key and generating my own unique id for each record. But, this breaks acts_as_tree. Because my new primary key is not an integer, it breaks the SQL query as follows: StatementInvalid in PagesController#create --------------------------------------------------------------------------------------
2006 Jan 11
3
How do you do a custom sql call in rails?
Hi. I am developing an industry specific crm that allows busineses to track customers in a particular way. Each customer will be assigned a customer number. The first customer will have a customer number of 1, the second customer_number = 2, etc... Note that this customer number is not global but particular to the account that created the customer (see schema snip below). I need to have a
2006 Oct 16
1
Question regarding ''tidy'' type
Hello all, I am trying to use the tidy type to clean up a directory that I use for running scripts via puppet. My relevant manifest looks like: tidy { "/root/.puppet/" : age => ''30D'', path => ''/root/.puppet/'', recurse => true, rmdirs => true, type => atime, } However, when I run puppet it
2017 Jan 16
3
[cfe-dev] Your help needed: List of LLVM Open Projects 2017
The list can't ommit clang-tidy. There are many ideas about new checks on llvm bugzilla. https://llvm.org/bugs/buglist.cgi?product=clang-tools-extra&component=clang-tidy&resolution=---&list_id=110936 Everything matching ".*Feature Request.*" Piotr 2017-01-16 21:31 GMT+01:00 Sean Silva via cfe-dev <cfe-dev at lists.llvm.org>: > Do we have any open projects on
2014 Mar 12
4
samba4 registry
Hello, ? I can read/access the registry on my samba 4.1.6 server, but I get a ?permission denied? if I write to some locations. Also, I cannot change the permissions. ? Is there any documentation about the registry on a samba4 server? ? Thanks, Mark
2008 Nov 12
5
dynamic condition for has_one and eager loading issue
Hi, I ve defined the following relation in one of my models with a dynamic where condition: has_one :selection, :foreign_key => ''object_id'', :conditions => ''selection_type = 1 and account_id = # {self.send(:account_id)}'' That works perfect, however when I try to eager load that relation I am getting the following error when doing a
2006 Jan 21
5
Help...why ''rake migrate'' can''t be executed on RadRails
''rake migrate'' command can''t be executed on RadRails? I found Terminal Window at RadRails and executed ''rake migrate'' on that terminal many times.but nothing happend,even error messages. I made InitialSchema file like these and configured database.yml. of course I made database before executing ''rake migrate'' anyone,get me
2009 Nov 27
2
update_attribute does not update
My server is running Rails 2.3.4...am I not doing this correctly or is something borked? >> c=Contact.last => #<Contact id: 24, name: "Larry", email: "larry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org", phone: 2147483647, account_id: 8, created_at: "2009-11-27 18:16:25", updated_at: "2009-11-27 18:40:08", hide_name: false, hide_phone: false,
2010 Dec 02
8
CanCan issue when being very specific
So I got CanCan and Devise working well. I have two types of users: Admins and Nonadmins. Admins can edit all of Nonadmins profiles. The problem is, every user (either Admin or Nonadmin) belongs to an Account or Organization. Admins should only be able to edit users from their own Account or Organization. I was able to do that too. The problem is, I can''t display the Create New User
2006 Jan 19
4
A simple scaffolding question
All, When I generate scaffolding on my model, it doesn''t display all the fields in the create and edit views. It populates the views with text/char and date types, but omits any integer fields. Is this normal behavior or a bug? Thanks! -Nick
2011 Jul 14
10
Devise confusing routes
I had a similar problem yesterday. I would go to the root of my site and I would get a Too Many Redirects message. It seems like there was an infinite loop. After struggling for over an hour yesterday late at night, it seemed like I fixed it. But now, when I want to create a New User, it''s redirecting me to the Sign In screen. Seems like I didn''t fix the problem completely. I
2006 Jan 17
9
using "find" when you have 2 has_many relations
An Account has_many Websites which in turn has_many WebsiteDomains Now I can of course do this: @domains = Account.find(1).websites.find(1).website_domains.find(:all) To get all the domains for Account with id 1 and Website with id 1. I would like to do something like this though: @domains = Account.find(1).websites.find(:all).website_domains.find(:all) IE, get ALL domains for all websites in
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
Hi, I have a situation I''m hoping someone out there may be able to shed some light on. I have a Rails app (2.1.0 on Ruby 1.8.7) with a wizard-based sign up process, that has recently been changed from storing incremental data in the database to having a medium sized object graph living in the user session until the user completes the entire sign up process (this is a business