search for: categories

Displaying 20 results from an estimated 5197 matches for "categories".

2006 Jul 08
2
Trouble getting select to work
I''ve tried pulling this together from examples in the book, searching the web and this list, but so far I''ve not been able to get it working just right. My table is a categories table with id and category fields. My form has the following: <td><%= select(''category'', ''category'', @categories = Category.find(:all, :order => "category").map {|cat| [cat.category, cat.category]}) %> I used [[cat.category, cat.catego...
2010 Mar 27
2
Shorter Rails 3 routes
Hi, I have a small blog application, and I would like to shorten its routes. Here they are: Blog::Application.routes.draw do resources :categories do resources :articles do resources :comments end end A rake routes command produce the following lines: GET /categories/:category_id/articles/:article_id/comments(.:format) {:controller=>"comments", :action=>"index"} categ...
2009 Oct 15
10
AJAX - how to have multiple select form sets implemented?
hi, there :) Consider a blogging application whereby a user is trying to add a new blog. He/she has to select a category. Upon selecting a category from a drop down box, a new sub categories drop down box will be created (hence an AJAX call). Got this implemented and it''s ok. Now, let''s assume that a given blog can have multiple categories (and subcategories). For example, a blog on a restaurant review can belong to the following categories & subcategories: 1) &...
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 = Category.find(:all) end This list all the categories on a view, but I don''t know how to get all the sub categorie...
2006 Mar 31
7
Checkboxes expand to show new options when checked?
I''m writing a simple CMS where every item ("listing") HABTM categories and subcategories (which themselves belong_to a category). What I''m trying to do now is create a UI effect for listing creation: when you go to create a listing, only the possible categories will be shown, but when you select a category a set of new categories will be displayed like s...
2006 May 31
3
instance variable problem
I''m having some trouble with an instance variable being read as nil in my app. I have an image uploading, that can be added to categories. The page loads up initially fine, and if I upload an image without errors everything works fine. I''m working on the validation, but with the code I have if their are validation errors it renders ''new'' again, but reads @categories as nil and errors out. In render :a...
2006 Dec 30
4
newbie question, "show items in selected city and category"
Hi, rails newbie needs help :) I have classified ads (cads) related with cities and categories: class Cad < ActiveRecord::Base has_and_belongs_to_many :categories has_and_belongs_to_many :cities end class Category < ActiveRecord::Base has_and_belongs_to_many :cads end class City < ActiveRecord::Base has_and_belongs_to_many :cads end I assume that user can act...
2006 Feb 13
4
Calling find()
Hello, sorry for the bulk question, but I cannot find answer anywhere, I have model like Phonebook::Category, and i`m stuck on calling find() method on this model ?
2007 Oct 09
2
fit.contrast and interaction terms
Dear R-users, I want to fit a linear model with Y as response variable and X a categorical variable (with 4 categories), with the aim of comparing the basal category of X (category=1) with category 4. Unfortunately, there is another categorical variable with 2 categories which interact with x and I have to include it, so my model is s "reg3: Y=x*x3". Using fit.contrast to make the contrast (category 1 vs...
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 making Subcategory a subclass of Category. Am I right? Unfortunately, there''s...
2006 Mar 29
11
why belongs_to does not like validation?
This works : class Recipe < ActiveRecord::Base belongs_to :category end But (when I add validation) this does not work : class Recipe < ActiveRecord::Base belongs_to :category validates_length_of :category, :within => 6..20 validates_uniqueness_of :category, :message => "already exists" end thank you -- View this message in context:
2006 Jan 10
5
Select Tag and Associations
Hi there, I''ve been working on this for awhile and have finally decided to ask for a little guidance.I have a slight problem trying to save a selection. I have two models: A "Posting" has_many "Categories", and a "Category" belongs_to one "Posting". With that said, in the posting model I have "has_many :categories" and within the category model I have "belongs_to :posting". That part I ''believe'' is correct, however I very well could be o...
2006 May 03
3
Sorting by multiple categories
I have a database with a field called ''category''. ''category'' contains the categories separated by a "," i.e. 1, 2, 5 I know with something like: @products = Product.find(:all, :condition => "category = ''1''") I could get some results if any of the ''category'' fields only contained "1" but most contain multiple v...
2006 Jun 17
5
Having trouble listing tiers of categories
I have categories and sub-categories in a table called "categories". Every row has a "parent" field to note if the entry is the sub-category of another (never goes deeper than 1 level). So there might be something like this: id | name | parent 1 Dog 0 2 Pug 1 3 Siames...
2006 Jun 14
13
Undefined method
I really hope this is not a bad question (as in he''s abusing the list). However I could use a little direction (even though I''m reading books, tutorials) Right now I''m getting a undefined method `category'' for 4:Fixnum The specific lines from the rhtml file are: <td><%= link_to position.category_id.category, :action => "show", :id =>
2006 Apr 15
7
New to rails - scaffold command , how to get related items?
Ahoy, I was able to follow the tutorials and build a simple to-do list program with Items and Categories and have the related tables link up w/ the default "scaffold :Items" command plus custom defenitions. Then I erased all of that and tried rebuilding the program using the ruby script/generate scaffold Item (and category) command. Now the templates look like " <% for column i...
2006 Jan 26
4
Override has_many :order at run-time?
Is it possible to override has_many''s :order attribute at run-time? e.g. something like: <% for category in @site.categories(:order=>''name'') %> ... <% for category in @site.categories(:order=>''rank'') %> ... thanks csn -- Posted via http://www.ruby-forum.com/.
2006 May 04
2
Building a FAQ
I''m new in Rails, and I''m building my first application. I''m trying to make a FAQ for this application, organized by product (questions about each product) and category (questions of different categories or topics), and there is something I can''t figure it out how to do. I have these tables: create_table "faqs" do |t| t.column "question", :text t.column "answer", :text t.column "product_id", :integer t.column "category_id", :integ...
2005 Sep 23
6
problem with acts_as_tree
Hi, I''m using the latest gem version of rails under MacOS Tiger. I was trying to use acts_as_tree as described in the rails book. So I have something like: class Category < ActiveRecord::Base acts_as_tree :order => "title" end create table categories ( id int not null auto_increment, title varchar(100) not null, parent_id int, constraint fk_category foreign key (parent_id) references categories(id), primary key (id) ); When I try to us...
2016 Jan 20
4
[3.8 Release] RC1 has been tagged
...... For example, recently with trunk r256945, I saw these: Failing Tests (39): libc++ :: std/depr/depr.c.headers/stddef_h.pass.cpp libc++ :: std/depr/depr.c.headers/wchar_h.pass.cpp libc++ :: std/language.support/support.types/max_align_t.pass.cpp libc++ :: std/localization/locale.categories/category.collate/locale.collate.byname/compare.pass.cpp libc++ :: std/localization/locale.categories/category.collate/locale.collate.byname/transform.pass.cpp libc++ :: std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp libc++ :: std/localization/lo...