Displaying 20 results from an estimated 83 matches for "subcategory".
2006 Apr 15
8
Inheritance in Rails - I need some help
I''ve got a model, "category" and another model "subcategory." Each
subcategory belongs_to a category, and a category has_many
subcategories.
What I need to do is set it up so that I can search Category and
Subcategory with one .find call. So:
Category.find(:all, <etc)
will find categories and subcategories.
Now, I believe this can be done by...
2006 Mar 30
5
Heeelp - no idea what''s going wrong.
...for category in @categories %>
<div id="fancy">
<input type="checkbox"
id="<%= category.id %>"
name="category_ids[]"
value="<%= category.id %>
> <%= category.name %>
</div
<for subcategory in category.subcategories %>
<div id="indented">
<input type="checkbox"
id="<%= subcategory.id %>"
name="subcategory_ids[]"
value="<%= subcategory.id %>...
2006 Jul 23
3
Newbie: Display hierarchical Records in a view
Hi,
I have two models: category and subcategory. (one to many
relationship), and a controller ''home''
I''d like to display all the categories and their sub categories in the
view: home\index.rhtml.
I have a method in the ''home'' controller'' like this:
def list_categories
@categories = Cate...
2006 May 07
2
Category and subcategories in database
I have a project I''m trying to decide if I want to use rails for. I''m new
to rails, so I''m not sure how easy it would be to implement something like
this using ActiveRecord. Here''s the situation:
Category > subcategory > subcategory > product
Category > subcategory > product
Some categories will have many subcategories, others few. I want to use
adjacency lists in the database like
ID CATEGORY PARENT
where top-level categories simply have no parent, but subcategories do. My
concern is whe...
2006 Apr 11
2
Finding items from two models - then merging them
...ings habtm categories and subcategories,
which are seperate models.
What I want to do is search categories for certain items, like so:
@categories = Category.find(:all, :conditions => ["name LIKE ?",
"#%{:search_string}%"
and subcategories for the same:
@subcategories = Subcategory.find(:all, :conditions => ["name LIKE ?",
"#%{:search_string}%"
Then I want to get @categories.listings, @subcategories.listings, merge
them into @listings, sort them by once of their fields, and display
them like so:
<% for listing in @listings %>
<%= rende...
2009 Oct 15
10
AJAX - how to have multiple select form sets implemented?
...categories & subcategories:
1) "food" -> "fine dining"
2) "people" -> "lifestyle"
3) "travelling" -> "restaurants"
After selecting a set of category and sub category, there will be a
link entitled, "add another category/subcategory" (I guess this can be
done with link_to_remote or something).
My question is, how do you code it such that upon clicking on the link
mentioned, another category drop down box will be displayed in the
form. Selecting a category value would then cause a sub categories
drop down box to appear in...
2006 Jul 02
4
:order in partial
Hi,
i was looking through the docs and couldn''t find a good clean solution
for ordering a partial with an :order clause.
say i was iterating over categories and thier corresponding
sub-categories (regular belongs to) and wanted to order the
subcategories according to a certain column;
<% for category in @categories %>
<% render: partial => ''sublist'',
2008 Apr 01
1
Navigation Problems
...b-Category5 edit delete
Sub-Category6 edit delete
When I click the Sub_Category link in either the navigation bar or the
main content, I should be directed to another page where the
Sub-Category''s children will be shown. But instead I have these errors:
NoMethodError in SubCategory#read
undefined method `each'' for #<SubCategory:0x351c414>
<div class="mH" onClick="toggleMenu(''menu1'')"><a href="#">+
AMD</a></div>
23:
24: <div id="menu1" class="mL">
25: <% @sub...
2009 Mar 11
1
Reshape question.
...o reshape the data using the reshape package.
First I read in the data:
a2009 <- read.csv("Total2009.dat", header = TRUE)
Then I trim it so that it only contains the columns that I have interested in:
m2009 <- melt(a2009, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity"), na.rm=TRUE)
Then I start to formulate the data that I will process:
c2009 <- cast(m2009, DayOfYear ~ variable | Category, sum)
Finally I aggregate the data:
t2009 <- cast(m2009, DayOfYear ~ variable, sum)
My question is on the...
2006 May 23
7
has_and_belongs_to_many question
...-----------------------
1 Some Category
2 Another Category
3 One More Category
sub_categories
-----------------------------------------------------
| id | name | category_id |
-----------------------------------------------------
1 SubCategory One 1,2
2 SubCategory Two 2
3 SubCategory Three 1,2,3
is there a way for Active Record to handle this type of table linking or
would it be better for me to create the third table to link these
together?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 07
13
Pop up menus - any ideas?
...%=category.name%>'')">
<%= link_to category.name, :action => ''category'', :id => category %>
<div id="subcategories_<%=category.name%>" style="display:none">
<div id="indented_categories">
<% for subcategory in category.subcategories %>
<%= link_to subcategory.name, :action => ''category'', :id =>
subcategory %>
<% end %>
</div></div>
<% end %>
Problems:
Obviously, the subcategories will never dissappear. Is there a
onmouseleave action I co...
2006 Mar 31
7
Checkboxes expand to show new options when checked?
...be shown, but
when you select a category a set of new categories will be displayed
like so:
Lions
Tigers
Bears
> click on Tigers
Lions
Tigers
Feeding
Breeding
Storing
Bears
> de-select Tigers and it returns to normal.
What I have right now is a display where every category and subcategory
is displayed at once. The code looks something like this:
<% for category in @categories %>
<div id="categories"> <input type="checkbox" /NAME, ID, VALUE ARE
HERE>
<%= category.name %>
</div>
<% for subcategory i...
2008 Dec 25
5
One question about Dynamic Select Menus
Hi all,
Merry X''mas first :-)
I have "Product","Category","Subcategory" 3 Model, and when new
"Product", I want to use "Dynamic Select Menus" just like Ryan
mentioned in http://railscasts.com/episodes/88-dynamic-select-menus
I have everything down. But when I visit the js file, I got following
error
Showing app/views/javascripts/dymanic_cate...
2006 May 12
2
Has many through join table issues
...to_categories
class Member < ActiveRecord::Base
has_many :member_to_categories
has_many :member_types, :through => :member_to_categories
My problem is two-fold.
1. When the visitor selects a top level category, I need to pull all
members of all of the related subcategories.
2. When a subcategory is selected, I only need to pull the members who
belong to that subcategory only.
My Category table:
id
name
parent_id
my member_to_categories table:
member_id
category_id
Any help will be greatly appreciated!
--
Posted via http://www.ruby-forum.com/.
2006 Mar 29
0
Many-to-many relationship with multiple models?
...ies (from
it''s two categories) as it wishes, and subcategories are displayed
differently in both administration and display views.
So what I have is:
Class Listing < ActiveRecord::Base
has_and_belongs_to_many :categories
has_and_belongs_to_many :subcategories
...
end
Class Subcategory < ActiveRecord::Base
has_and_belongs_to_many :listings
belongs_to :categories
end
Class Category < ActiveRecord::Base
has_and_belongs_to_many :listings
has_many :subcategories
...
end
Is this allowed? I ask because I can''t create a listing with
subcategories (from t...
2006 Apr 14
1
Model extends and belongs_to another model - problem
I have a model, categories, and another model, subcategories. In my
current code these have no connection except for the fact that
categories has_many subcategories and a subcategory belongs_to a
category. But by necessity, I need to change it so Subcategory extends
Category; so that I can search both models with one command.
I was hoping it would be as simple as changing Subcategory <
ActiveRecord::Base to Subcategory < Category, but no such luck. Now I
get the erro...
2017 Aug 07
2
AliasAnalysis: may-alias subcategory
Hi,
The current AliasAnalysis marks may-alias for cases when memory passed as function argument.
i.e.
void foo(int *A, int *B, int *C) {
for (int i=0; i<N; i++)
A[i] = B[i] + C[i];
}
In the above example, it's may-alias for memory 'A', because 'A' is not known at 'foo' call sites.
Alias analysis is able to figure out memory 'A' is no-alias, if I
2005 Dec 21
0
Category/subcategory CRUD
Hello there! This is my first post! ;)
I''m starting on ruby on rails, so I have many doubts about it!
I''m trying to create a system that uses categories/subcategories.
I created a scaffold for a table that has the following fields:
- id int(11)
- name varchar(50)
- keyname varchar(50)
- visible enum(''0'',''1'') default ''0''
-
2006 Aug 06
1
Newbie: populate 2nd dropdown list based on user''s selection in 1st dropdown list
Hi,
I am creating a form that a user can post a message based on his
selection on category and subcategory. (A category has many
subcategories.)
How do I dynamically populate subcategory dropdown list when user
chooses a category from category dropdown list?
Thanks in advance.
--
Best regards,
Ming Ma
2017 Aug 07
3
AliasAnalysis: may-alias subcategory
...use-it's-input”.
Regards,
Ashutosh
-----Original Message-----
From: Nuno Lopes [mailto:nunoplopes at sapo.pt]
Sent: Monday, August 7, 2017 6:12 PM
To: Nema, Ashutosh <Ashutosh.Nema at amd.com>; llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] AliasAnalysis: may-alias subcategory
You're right that stating may-alias(A, B) and may-alias(A, C) are the only possible answers right now, since the compiler cannot possibly know if these alias or not.
LLVM supports the noalias attribute for function parameters, which may be what you're looking for? http://llvm.org/docs/Lan...