similar to: has_many through select box in form

Displaying 20 results from an estimated 10000 matches similar to: "has_many through select box in form"

2007 Jun 25
1
has_many with :dependent => :nullify
Hi all, There is something confusing with has_many in the current API : When deleting a record with association.delete, the corresponding association''s foreign key is nullified. However, if has_many has the :dependent option set (to any value), the association''s destroy method is called instead. This is awfully inconsistent with the behavior expected when setting :dependent to
2011 Apr 06
2
Wish List: has_many :dependent => {}
I am after a nice way to disable (not destroy, delete nor nullify) all associated records. I''m a hoarder, I don''t want to get rid of anything but I want to stop records being visible. I have a disabled boolean in my tables and if I disable the top record in the association (say the association is 5-6 levels deep), I would like to cleanly disable its children. I''ve
2010 Mar 24
1
How to stub a has_many relationship in Rails 2.3.5
We have a test that has been working find until we upgraded to rails 2.3.5. I''m not too familiar with mocks/stubs so maybe there is an easy solution. Here is a simple example of our scenario. Class Person < ActiveRecord::Base has_many :aliases, :dependent => :nullify before_destroy :mark_aliases_as_deleted def mark_aliases_as_deleted self.aliases.each do
2007 Oct 18
0
Getting the through items from a has_many :through :uniq relationship
Getting the through items from a has_many :through :uniq relationship In a nutshell, I have been using the has_many :through :uniq relationship, and I want a DRY way to list the join model objects. Currently, my objects include taxon objects, toxin objects, data_object objects, and taxon_toxin_citation objects ("citation" is another word for data_object). A taxon has many data objects,
2006 Jul 31
0
Issues with has_many, belongs_to and dependency settings
I have 2 models SmsAddress & OutboundSmsAtom SmsAddress { has_many :other_objects, :dependency => :nullify } OutboundSmsAtom { #note this object also "belongs_to" other objects if that matters belongs_to :this_object } Whenever I try to destroy an object of type ThisObject, which at the time has 0 "children" OtherObjects I get the following type of
2006 Jun 07
3
#5209 patch: :dependent => :nullify deletes child records
Hi everyone, A couple of weeks ago I noticed a bug with :dependent => :nullify on a has_many or has_one. When you delete the parent, the children''s foreign keys are nullified, as expected. But when you do parent.child.delete or parent.children.clear, ActiveRecord actually deletes the child records, rather than just nullifying them. In my eyes, if you''ve set
2006 Aug 09
0
select-multiple for has_many association
I haven''t looked into this for several months, but there still doesn''t seem to be an obvious way to generate a HTML select element for choosing multiple items to be set for a has_many association. <select id="person_task_ids" multiple="multiple" name="person[tasks][]"> <option value="1">Do something</option>
2006 Jul 10
0
Dependent nullify doesn''t use save?
If you have a model that has has_many :clients, :dependent => :nullify Will that run the save method for each client or will it just simply nullify the foreign key using straight SQL without every calling save. Because I have some very important before_save code in my Client model and I do not think it is getting ran. Thanks for your help. Thank You, Ben Johnson E:
2011 May 17
0
Select not maintaining state on nested form with
I am using nested forms with multiple instances of various of the forms. The problem I cant figure out is how to maintain state for the select between postbacks. I am using ''options_from_collection_for_select'' and in this the last param is to be the selected value, but given the dynamic nature, the value is going to depend on the iteration of the form builder. If I manually force
2010 Sep 16
1
[RFC] function to parse string to argc/argv pair
Currently, I'm looking to improve rosh and would like to start using getopt(). I'd like to parse a string obtained by fgets() to be like the argc/argv pair created by __parse_argv but in a way that's more cross-platform (such that it can also be used by .lnx files rather than just COM32) and suitable to use in rosh and lua.c32. I've made a function and inlined a test program for
2007 Jul 17
5
habtm confusion
Hello friends! I am trying to make a database that will have a group of people set to committees, and a person can be in multiple committees, and a committee obviously has multiple people. The people are senators at my university. These are my current models: senator.rb: -- class Senator < ActiveRecord::Base validates_presence_of :first_name, :last_name, :floor has_and_belongs_to_many
2009 Feb 17
3
Dynamic select box
Hi everyone, I have a problem. I want to display a different select box wether the current user is an admin or an user. So I thought I could do this in my view where my form is displayed : <p class="form-input"> <%= f.label(:role_id, ''Role:'') %> <% if (current_user.admin?) then collection_select(:user, :role_id, Role.find(:all, :order =>
2012 Nov 21
0
BiodiversityR and box cox transformation
Hi all: I am trying to use the BiodiversityR package in Rcommander since I need to box-cox transform some data. However, even when trying with the example files, I get this error just after selecting the box cox transformation in the Menu, and Rcommander and Rstudio just shut down. What is it? What could I do? Thanks a lot The instruction at "0x00000001" referenced memory at
2006 Apr 15
1
Is this a HAS_ONE bug?
Let''s say I have: A BELONGS_TO B B HAS_ONE A (with :dependent=>:nullify) But this association does not need to exist. In other words, I could have many A''s and B''s that are not associated in this manner. Presently, if I try to delete "B": 1. If B is associated to an "A", this works fine and A.my_B is nullified. 2. If B is NOT associated, I
2006 Jul 19
0
Clearing dependent collections
I have a user model that owns messages : class User < ActiveRecord::Base has_many :messages , :dependent => :nullify end I''m using nullify so that when the user is deleted, the messages continue to exist - they''re just marked as being ownerless. However, calling user.messages.clear actually deletes all his messages, which I was a little surprised at. I would
2006 Apr 21
1
select box with multiple rows
I want a select box that displays 5 rows instead of one row and a drop down. so i figure this should work, but it doesn''t. <%= collection_select(:constellation, :region_id, @regions, :id, :name, html_options = {:size => ''5''})%> I am not quite sure how to use that html_options and googling around I didnt find anything directly on point. Any suggestions?
2006 Jan 03
1
prompting to choose an item from a select box
Hi: Sad question, I know. I saw it somewhere but can''t rediscover it. I have a collection_select and want to add a prompt so the dropdown displays "select one" How is that done? thanks. bruce
2006 Jun 29
0
HABTM and select form helper
I am very confused about HABTM and a form select statement that I need to implement. I have two objects - Person which has the following fields: id, firstname, lastname, email Category which has the following fields: id, name A person HABTM categories and also the reverse. I have setup the join table using a migration. All that went well. Two questions - If I want to edit a person, how do I
2013 Nov 23
0
[Bioc-devel] package citations
(xposted to bioc-devel and r-devel as I feel it is relevant to both communities) As someone whose body of work is likely to consist mostly of infrastructural packages and research directly in computing I wholeheartedly agree with Kasper's suggestion that we as a community should work to provide and use package citations. I borrow heavily from existing work in terms of both concept and
2006 Apr 24
4
creating a select box
Hi trying to create a select box in _form.rhtml. I have a table called organisations that contains fileds, 2 being ''id'' and ''name'' these are the fields I need to bring over to the clients _form.rhtml. whats the best way of going about that?? 2 ways i have seen suggested that I cant get to work -@organisations = Organisation.find_all placed this in def new