similar to: Has and belongs to many ... howto in the view?

Displaying 20 results from an estimated 20000 matches similar to: "Has and belongs to many ... howto in the view?"

2006 Mar 30
5
Heeelp - no idea what''s going wrong.
I''m working on a simple CMS. The main data type are "listings" a listing habtm (has_and_belongs_to_many) categories and subcategories. Subcategories belong_to categories. Subcategories are basically the same as categories, but they are treated differently in a few situations. The problem is, I can''t seem to write the view/controller/model code that allows me to
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
Hi All, I''ve tried to do my searches, but can''t find reference to this anywhere - My question is about ActiveRecord inserts and IDs. I have a join table that both the models of the source tables join with "has_and_belongs_to_many". It seems like ActiveRecord is setting the "id" field for the join table- This should be an auto_increment and
2006 Feb 20
1
belongs_to, has_one, has_many question (again?)
Hi All, Probably this has been asked numerous times, I apologize already! Can somebody point me to a good tutorial on how Rails works with relations? I know about database design and normalization, I also know about programming in general (and OOP for that matter). Only thing I can say is that I''m following the "Four days on Rails" tutorial by John McCreesh. He writes
2008 Jan 08
1
HOWTO: Add a new line, Remove new line?
Hello everyone, I have a couple of checkboxes, where each checkbox belongs to a specific input field (which has a value). So whenever the user clicks on the checkbox, each value of the associated input field is added up and placed in the ''result'' ID. I''m using unobtrusive Javascript to make this happen... However I want to able to add and remove a new line (checkbox
2006 Mar 26
3
Making a custom selection form - newbie
Hello all, I''ve been working with Ruby on Rails for a few weeks now. It''s difficult for me because I don''t have much experience with Ruby, Rails, MySQL, or any other web-languages. But I''m trudging on and learning a lot. I''ve been working on a web application for my dad''s website; it''s a simple content manager for
2006 Jul 11
4
checkboxes with a has_many :through relation
All, I''m populating a view with checkboxes in a list. I want to be able to assign to my has_many relationship using the post values of these checkboxes. Essentially, I want to populate the relationship table which will create the correct join values in my model. Here is my check_box_tag code: <%= check_box_tag("@current_job[target_list_ids][]",
2006 Jul 02
2
Problems implementing a N:M table that contains actual data
Hi everyone, I''m currently finishing the planning phase of a small project I want to create. I read a bunch of tutorials about ActiveRecord and the different way to link your "tables" with belongs_to, has_many, has_and_belong_..., etc... However I''m stillnot sure if what I''m trying to do will work *well* with ActiveRecord. So enough talk,
2006 May 31
2
Checkbox Help
Hi guys, I am need to help again. Sorry for the newbie query but would definitely appreciate the help. Here''s the q: I generate a list of items from the database and render them out with a checkbox beside them. A user may click more than one item and I would want to save all checked items into another table. I have been able to give each checkbox a unique id . Would anyone be able
2006 Jul 17
6
Best Practices: Splitting the "view model" from AR model
All, I''m starting to see view state information creeping into my model class. For example, I have text fields in my view that need to be set a certain way depending on whether or not a checkbox is checked. And while the values of these text fields ultimately do represent database columns that are related to the backing AR object, the text_field values also represent attributes on a
2006 Jul 19
6
Howto: Check_box with a variable (no model)
Hi, I would like to put a checkbox on a form where the input field is a variable rather than a field in a model. The normal way (with a model) would be: <%= check_box(''client'', ''accept'', {}, "1", "0") %> But since accept is a variable @accept and model client will not be there, how do I make a check box work? Regards, Paul
2007 Dec 17
6
Checkbox array and Ajax.updater
Hello all, I have some checkbox array like these: <input type=checkbox name=list[] value="1">Java<br> <input type=checkbox name=list[] value="2">JavaScript<br> <input type=checkbox name=list[] value="3">ASP<br> <input type=checkbox name=list[] value="4">HTML<br> <input type=checkbox name=list[]
2009 Jun 28
1
CheckBox and Ruby on Rails
I have two questions: 1. I have a checkbox on a form and after submit I need to check the status of the checkbox. Any idea how to see what the checkbox is set to? I am assuming this must be done in the controller or model but cannot figure it out. 2. On load I am checking for a cookie and need to determine if the checkbox should be checked or unchecked. Is there a way for me to do this from
2011 May 30
5
rails habtm checkboxes with jquerymobile
Hi guys, I have a habtm association working properly. My application consists of both a desktop and a mobile version. My mobile version is made with jquerymobile and I would like my checkboxes in the edit form to look like the checkboxes shown in http://jquerymobile.com/demos/1.0a4.1/#docs/forms/forms-checkboxes.html. My desktop code is the following: <%= check_box_tag
2007 May 25
3
check box value in array
Hi guys, I have a group of check box in rails page. check box Code as below: <% for count in @total_cellno %> <input name="checkbox" type="checkbox" value="<%= count %>" /> <% end %> I want to receive the selected value in my controller model. @selected_box << params["checkbox"] I guess that it provides values
2006 Apr 23
1
checkboxes for filtered search
I have a page that renders a series of about 20 checkboxes on the left hand side with content on the right. These checkboxes are created from a DB and that part is all working well. What I want to do is have a user click on a checkbox [genres] and have the content on the right be filtered based on the checkbox ticked. If a user clicks on more than one checkbox than only those stories
2006 Aug 12
1
has and belongs to many different?
Is there such a thing? I am thinking of an application that has something like this: 1. person has many things - there is a ''persons'' table 2. the things he has are stored in a table that is something like this person_id, thing_table_name, thing_id For example, it may map to person1, books, 23 #Person 1 owns book 23 person1, books, 25 #Person 1 owns book 25
2006 Jul 11
1
Has And Belongs To Many and Pagination
I''m struggling with the issue of pagination and many to many relationships. I have products and categories (a many to many relationship.) When I go to a category page, I wish to load all products associated with that category and have pagination of the products. @category_products = @category.products gives me all the products associated with the category however, when I try to
2006 Mar 17
1
Design / Pattern / Scaffold for has-and-belongs-to-many ?
Is there a standard practice for providing a UI into HBTM relationships? I have a model User, and a model Training, and I need to manage both relationships -- show me all the people that have training X, but also show me all trainings user U has. And, of course, "Lookup this user and then add/remove trainings for this person" or "Lookup this training and add/remove
2005 Apr 20
2
Has And Belongs To Many Validations
Here is the schema that I am working with: courses -> courses_teachers <- teachers I want to ensure that a teacher is not assigned the same course more than once. In other words, if I''m in the courses_teachers table as teaching Spanish 101, if someone tries to add that same teacher/course combination to the table again, it will not be allowed. I thought I could use something
2006 May 11
3
multiple checkbox values, convert to string, 1 db field
Basically what I''m trying to do is create a way for users to enter "keywords" that will then be searchable. I.e., when a user creates a new Item, there is also a keywords field in the database that is a string like "purple triangle free" -- but all the user sees when they are creating the keywords is a series of checkboxes like: __blue __red __purple __circle