similar to: Forms Containing Collections problem

Displaying 20 results from an estimated 120 matches similar to: "Forms Containing Collections problem"

2006 Mar 30
5
Has_many :through problems -- please help
I''m having a lot of trouble with has_many, :through and could really use some assistance. I''ve got a User and Group class. Users can subscribe to groups, and groups should know who''s subscribed. I''ve got a join table (group_subscriptions) with group_id, user_id, and it''s own id element. Users has "has_many :groups, :through =>
2006 Mar 16
2
WEBrick and OS X 10.4.5 problems?
Has anyone who is running OS X 10.4.5 and the security patches thereafter noticed that WEBrick is no longer functioning? I have a machine at school that I believe to be patched with 10.4.5 but not with the latest security patch and WEBrick seems to run fine for it. However, on my machine at home I can''t get WEBrick to successfully run even freshly generated apps. For both
2006 Mar 15
5
Passing params to a component
I see from http://rubyonrails.org/api/classes/ActionController/Components.html that is possible to pass paramaters to a component. I don''t understand the exact syntax. I''m trying: @master_id = @params[''master_id''] in the components controller but it is not working. ==== Details: In my calling view I have: <%= h(@opportunity.id) %> <div
2006 Mar 22
2
habtm vs. has_many/belongs_to
In AWDWR David says (pg 232), "When a Join Wants to Be a Model: While a many-to-many relation with attributes can often seem like the obvious choice, it?s often a mirage for a missing domain model. When it is, it can be advantageous to convert this relationship into a real model and decorate it with a richer set of behavior. This lets you accompany the data with methods. As an example,
2006 Mar 15
3
App design help for a newbie (trying again)
Hi there, I''m working on a new student portal system using Rails for a large university. As part of this application, I plan on students being able to customize their own calendar, collection of commonly used links, aggregation of newsfeeds (from the university, student groups, etc), and to see a listing of major announcements they should be aware of. It seems to me, to make the most
2006 May 31
7
How do you create a controller & view to create a list of objects?
I''m trying to figure out how to design a view and controller to work with a simple collection. I have a Foo that has many Bars, so here''s what I did: $ ruby script/generate model Foo $ ruby script/generate model Bar (Uncomment t.column, :name: :string in foo and bar migrations) (Edit Foo.rb and Bar.rb, add has_many :bars to Foo, belongs_to :foo to Bar) $ rake db:migrate $ ruby
2010 May 23
1
[Rails 3] Trouble with named routes and form_for
Hi guys, I''m having trouble getting named routes and form_for to play nicely in quite the way I would expect. Here''s a quick summary of what I''ve got going on: Named route: resources :thread, :class_name => "forum_thread" Controller name: forum_thread_controller Model object: forum_thread In both my new and edit actions I''m setting up an
2012 Nov 12
3
Updating objects in arrays
Perhaps this is a Rails issue. However, I need to first determine whether I simply am missing something about updating members of an array. I have an array of 10 ActiveRecord objects. I wish to iterate over the array and update an attribute. When I do this the underlying table row changes but the object in the array frequently does not. For example: count = 0 current_entries.each do
2007 Mar 30
10
check_box_tag not passing 0 when unchecked?
Code: <%= check_box_tag("person[#{person.id}][is_approved]", 1, true) %> Rendered output: <input checked="checked" id="person[7][is_approved]" name="person[7][is_approved]" value="1" type="checkbox"> Problem: The value of "1" is always passed, even if the box is UNCHECKED. Suggestions? Thanks! -- Posted via
2006 Apr 20
0
collection_select returning multiple values
Hey, Is is possible to make collection_select return multiple values? If yes, how can it be done? I?ve tried: <%= collection_select("group[]", "id", @groups, "id", "name", {},{:multiple => true}) %> Leading to: You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error
2006 Apr 03
0
has_many questions
My application has two models I''d like to have multiple join tables between, Users and Groups. Users have the ability to subscribe to a Group, while a Group would like to know its membership. Additionally, a User can administer several Groups and a Group should know about its several Administators (Users). I have the following declarations: class Administrator <
2006 Mar 15
0
App design help for a newbie
Hi there, I''m working on a new student portal system using Rails for a large university. As part of this application, I plan on students being able to customize their own calendar, collection of commonly used links, aggregation of newsfeeds (from the university, student groups, etc), and to see a listing of major announcements they should be aware of. It seems to me, to make the
2006 Jul 06
0
Using in_place_editor_field for collections?
I am trying to use in_place_editor_field to make many objects editable at the same time. I think I solved the first step of this problem; before it was giving me a problem about referencing a nil, so I did this: <%= in_place_editor_field ''question[]'', :name %> adding the [] seemed to fix things. Now all the fields show up on the page and they are all clickable. But
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 Jul 20
0
Getting joined collections on a form
Greetings, I''m looking for suggestions on how to simplify getting customer addresses on a form: I''m jumping between controller and view several times; alternating between rhtml and rjs, in order to display customers and their addresses on an invoicing form. It''s very messy. I have a one to many relationship between Customer and Addresses, each customer has one or more
2006 Jun 04
2
Manipulating collections
I appreciate this is basic stuff but can''t seem to find the answer anywhere using Google. If someone could point me in the direction of some documentation on this I would be very appreciative. If I have a collection as follows: @stuff = Stuff.find_by_type(''new'') And I then want to add something onto it, how can I add to this collection? Additionally how could I go
2006 Jun 12
0
Realtime form validation for forms containing collections
Hi, I''m successfully using the realtime_form_validation plugin from http://railsrtv.rubyforge.org/ However, my forms contain collections, as described in the AWDWR book. Basically my form looks like this. 2004 2005 2006 Question 1 12 13 15 Question 2 9 11 13 I have the following code to generate ids for my input fields.
2006 Jun 17
0
Dynamic forms containing collections
Hiall, I have the following problem: I need to use forms containing collections (i will call them FCC), and I want to construct them dynamically, as I need to deal with quite large forms (more than 600 input fields). The variables @model_name and @field_name contain the proper model and field names as strings, which is enough for "normal" form input fields. (i.e. the "if
2006 Apr 12
0
Validating collections
I saw this issue addressed in mid-January under the heading ''TIP: Using field_error_proc to add style attributes to form elements'', but I didn''t quite get it. I have a collection of objects that I want to input in one form and validate (during update). The suggestion in the post I referred to above was to use something like [in form] > <% for @comment in
2006 Apr 21
0
Caching of collections/references on session?
I''m using the user engine and therefore have a current_user User object on my sessions. User has a collection called ''properties'' and I am accessing the Property objects via the current_user session variable and also directly with Property.find. The problem I have is that rails seems to be caching the properties collection over requests (I can see the collection