Re: [Rails] Condition on fields_for

2015-06-03 Thread botp
On Tue, May 26, 2015 at 5:56 AM, Elizabeth McGurty emcgur...@gmail.com wrote: Colin, I pretty much would prefer if you didn't bother with my posts. I am functioning in earnest, and think that folks understand that. I don't want you policing my site conduct. Liz This is an old post, but I

Re: [Rails] Condition on fields_for

2015-06-02 Thread Elizabeth McGurty
Dear All, Pretty sure that I have been quite earnest in updating my application with particular concern for n+1 issues, otherwise, hopefully, more complete use of of Rails 3.0 model associations. If one really scrutinizes my models, you will see that I have not been totally thorough... a

Re: [Rails] Condition on fields_for

2015-05-25 Thread Colin Law
On 24 May 2015 at 22:22, Elizabeth McGurty emcgur...@gmail.com wrote: Colin you are kind of scaring me. Maybe I selected the wrong Reply' icon, but I think that I have always thanked folks. Nobody has suggested that you have not thanked folks. What I was commenting on was the fact that you

Re: [Rails] Condition on fields_for

2015-05-25 Thread Elizabeth McGurty
What suggestion did I ignore? On Sunday, May 24, 2015 at 5:00:50 PM UTC-4, Colin Law wrote: On 24 May 2015 at 21:48, Elizabeth McGurty emcg...@gmail.com javascript: wrote: I am thanking you, Colin That is ok, glad to be of help. However I note you ignored my other suggestion, or at

Re: [Rails] Condition on fields_for

2015-05-25 Thread Elizabeth McGurty
Colin, I pretty much would prefer if you didn't bother with my posts. I am functioning in earnest, and think that folks understand that. I don't want you policing my site conduct. Liz On Monday, May 25, 2015 at 4:26:47 PM UTC-4, Colin Law wrote: On 24 May 2015 at 22:22, Elizabeth McGurty

Re: [Rails] Condition on fields_for

2015-05-24 Thread Colin Law
On 24 May 2015 at 19:10, Elizabeth McGurty emcgur...@gmail.com wrote: Thank you so much! Very helpful. I have to get over my old-school practices. Who are you saying thank you to? The quoted message did not seem to include any help. It might be better to put your reply after the relevant

Re: [Rails] Condition on fields_for

2015-05-24 Thread Elizabeth McGurty
Thank you so much! Very helpful. I have to get over my old-school practices. Liz On Thursday, May 21, 2015 at 6:00:45 PM UTC-4, Walter Lee Davis wrote: Do these addresses have any difference besides being primary or secondary? Are there extra fields in one that are not in the other? Or is

Re: [Rails] Condition on fields_for

2015-05-24 Thread Elizabeth McGurty
Colin you are kind of scaring me. Maybe I selected the wrong Reply' icon, but I think that I have always thanked folks. You have no idea how much I appreciate what I have learned. My plan was that when my app was settled, incorporating all I learn I was going to give a big Shout Out! On

Re: [Rails] Condition on fields_for

2015-05-24 Thread Colin Law
On 24 May 2015 at 21:48, Elizabeth McGurty emcgur...@gmail.com wrote: I am thanking you, Colin That is ok, glad to be of help. However I note you ignored my other suggestion, or at least did not act on it. I was: It might be better to put your reply after the relevant section of the message

Re: [Rails] Condition on fields_for

2015-05-24 Thread Elizabeth McGurty
I am thanking you, Colin On Sunday, May 24, 2015 at 3:25:06 PM UTC-4, Colin Law wrote: On 24 May 2015 at 19:10, Elizabeth McGurty emcg...@gmail.com javascript: wrote: Thank you so much! Very helpful. I have to get over my old-school practices. Who are you saying thank you to? The

Re: [Rails] Condition on fields_for

2015-05-24 Thread Colin Law
On 24 May 2015 at 02:56, Elizabeth McGurty emcgur...@gmail.com wrote: Okay... I am really trying to be super vigilant to best Ruby/Ruby on Rails practices here... the whole n + 1 matter particularly I have a parent table called Advertiser: This is how it looks on the database: CREATE TABLE

Re: [Rails] Condition on fields_for

2015-05-23 Thread Elizabeth McGurty
Okay... I am really trying to be super vigilant to best Ruby/Ruby on Rails practices here... the whole n + 1 matter particularly I have a parent table called Advertiser: This is how it looks on the database: CREATE TABLE advertisers ( advertiser_id varchar(40) NOT NULL, title varchar(50)

Re: [Rails] Condition on fields_for

2015-05-23 Thread Elizabeth McGurty
Thank you very, very much! a = Lender.find('7oV71d1oVtxfyS9Ra6hnUtNe31N').addresses.select('state_id_string') a.blank? On Friday, May 22, 2015 at 5:05:25 PM UTC-4, Colin Law wrote: On 22 May 2015 at 20:28, Elizabeth McGurty emcg...@gmail.com javascript: wrote: Walter, Stewart Many

Re: [Rails] Condition on fields_for

2015-05-22 Thread Colin Law
On 22 May 2015 at 20:28, Elizabeth McGurty emcgur...@gmail.com wrote: Walter, Stewart Many thanks to you. Definitely making so much progress here. All seems to be going really well, but I remain stumped at a critical point Given the model, I pass from the controller @parent =

Re: [Rails] Condition on fields_for

2015-05-22 Thread Elizabeth McGurty
THANKS! Sorry I responded to Walter before I read this -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To

Re: [Rails] Condition on fields_for

2015-05-22 Thread Elizabeth McGurty
Thanks, but I think that I figured it out In parent AR, attr_accessible :addresses_attributes has_many :addresses ### Pretty sure should be plural for has_many, and singular for has_one accepts_nested_attributes_for :addresses Then in the view I have (abbreviated) form @parent_object do

Re: [Rails] Condition on fields_for

2015-05-22 Thread Elizabeth McGurty
Walter, Stewart Many thanks to you. Definitely making so much progress here. All seems to be going really well, but I remain stumped at a critical point Given the model, I pass from the controller @parent = Parent.object All of the field_for aspects are working really beautifully. But in

Re: [Rails] Condition on fields_for

2015-05-21 Thread Walter Lee Davis
Do these addresses have any difference besides being primary or secondary? Are there extra fields in one that are not in the other? Or is primary maybe a boolean on the address object? Walter On May 21, 2015, at 3:36 PM, Elizabeth McGurty emcgur...@gmail.com wrote: I have a parent table.

Re: [Rails] Condition on fields_for

2015-05-21 Thread Stewart Mckinney
Create two associations with conditions on the parent table with conditions that point to each type of address. For instance: has_many :addresses has_one :primary_address, -() do where( :type = :primary ) end, :class_name = Address This will make primary address accessible through addresses

Re: [Rails] Condition on fields_for

2015-05-21 Thread Stewart Mckinney
*changes to one association will not be reflected in the other until reload. On Thu, May 21, 2015 at 6:14 PM, Stewart Mckinney lordma...@gmail.com wrote: Create two associations with conditions on the parent table with conditions that point to each type of address. For instance: has_many

[Rails] Condition on fields_for

2015-05-21 Thread Elizabeth McGurty
I have a parent table. And associated with that parent table is two possible addresses, a primary one and/or an alternative: (has_many and accepts_nested_attributes_for). Rather than creating a second addresses table, I have used a flag, address_type to distinguish primary from alternative,