Displaying 20 results from an estimated 10000 matches similar to: "undefined method `category_id''"
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello,
I''m having a problem utilizing the find_all method with a value from a
form. I keep getting the following error:
Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'':
SELECT * FROM items WHERE (category_id11)
The controller seems to be getting the correct data, but my key and
value seem to be mashed together(it''s
2006 Apr 28
1
undefined method `name'' for #<Category:0x3820f70>
All,
I am having a bit of trouble with the error. I hava a product and
category table and wanting to display the categories in a drop down
list. Below is the error I get. Any suggestion on how I can fix this.
undefined method `name'' for #<Category:0x3652448>
9: <select name="product[category_id]">
10: <% @categories.each do |category| %>
11:
2006 Jan 07
2
help
I am at a lost with error below:
Extracted source (around line #15):
12: <p><b>Category:</b><br>
13:
14: <select name="product[category_id]">
15: <% @categories.each do |category| %>
16: <option value="<%= category.id %>"
17: <%= ''selected'' if category.id == @product.category_id
2009 Sep 24
8
Drop down list ?
Hi Gurus, I''m trying to tackle a drop down list. I have category and
item dbs, and they''re wired up with category has_many :items and item
belongs_to :category, and an item has a category_id. I have this code
in my new/edit.html.erb for item:
<%= f.collection_select :category_id,
Category.find_main, :id, :header, {}, :multiple => false %>
And a pretty drop down list
2005 Mar 10
2
Newbie question - form validation
Hi,
I am sorry for maybe stupid question. I am new in rails.
I am trying to create very simple weblog systeme. I know threre are
plenty of them, but It''s good to study. I create following rule in
models/post.rb
validates_length_of :header, :in => 3..50, :allow_nil => false,
:message => "At least 3 characters"
It''s working fine with default scaffolt add
2006 Oct 12
3
Help with observer_form , javascript error
I''ve set up an observer form, it is not working nor throwing error at least
in loading the page.
The Firefox javascript console is showing this error:
Error: missing } after property list
Source File: http://localhost:3000/ajaxsearch/list
Line: 165, Column: 45
Source Code:
hide(''roller'')}, parameters:''Form.serialize(''asearch'')='' +
2006 Jan 13
4
missing foreign key fields in scaffold views
Is there any reason that foreign key fields do not show in any of the
scaffold views ?
project table:
id serial primary key,
category_id integer,
user_id integer,
name varchar,
morestuff varchar
foreign key (category_id) references categories(id),
foreign key (user_id) references users(id)
scaffold generated views only show name, morestuff fields
2006 Jan 13
3
related drop down list / ajax
Hi all,
I''m trying to create a related dropdown box:
In my view:
<select name="category" id="category">
<option value="">Select category</option>
<% @categories.each do |category| %>
<option value="<%= category.id %>">
<%= category.title %>
</option>
<% end %>
2006 Mar 01
1
question
Hello all!
I would like to get an admin interface for my shopping cart app
up and running using rails. The admin interface will be used for
Customers, Products, Catggories, ect management. My db schema reflects
the above mention tables names. The question I have is could I use the
scaffold feature this way:
(eg)---ruby script/generate scaffold Products Customers Categories
Admin?
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
=>
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)
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 Jun 29
2
HABTM with multiple select list
Hello,
I am very new to ruby and need to create my first HABTM with multiple
select list.
I am having problems saving data in the middle(linking)
table.
1. titles can have multiple categories
2. categories can have multiple titles
Categories, titles and categories_titles tables are created.
----- title_controller.rb--
def new
@title = Title.new
@categories =
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all,
I am a newbie to Rails. Please enlighten me on how to do this
appropriately, the Rails and the Ruby way:
Suppose I have a Recipe model. Let''s simplify things and pretend that
it has only 2 attributes, a :name and the other is a ''category_id''. In
the recipes table, category_id is a foreign key to field id of table
categories.
We also assume that I have generate
2006 Jan 06
3
Cookbook recipes eg - ordering categories in the recipe pull-down box
People,
I can order categories when looking at the categories list page but how
do I change the recipe page to list the categories in alpha order in the
recipe pull-down box?:
> <p><b>Category:</b><br>
> <select name="recipe[category_id]">
> <% @categories.each do |category| %>
> <option value="<%= category.id
2006 Jan 19
4
Controller / Model confusion
I have created a product, with two controllers and two models, one for
categories and one for articles. In my models directory, I have
article.rb and articles.rb and seem to have code that relies on both of
these!
I am unable to get any validation working because of this (whichever
model I put the code in, it doesn''t load it)
Should I just rip it all apart and start again?
--
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
2006 Oct 11
2
Help please with observe_form - not working
My observe_form is basically totally limp. I think it should update without
hitting submit button but even if I hit it , it doesn''t change (doesn''t seem
to post the data).
Can anyone please take a look and see if I"m doing something wrong. TIA
Form:
<% start_form_tag({:action => "livesearch"},
:id => "asearch") %>
2006 Apr 16
11
Best way to sort categories w/ pager
Ahoy,
I made this pager,
" def list
@item_pages = Paginator.new self, Item.count, 10, @params[''page'']
@items = Item.find :all, :conditions => "category_id =
#{params[:condition]}",
:limit => @item_pages.items_per_page,
:offset => @item_pages.current.offset
@categories = Category.find_all
2009 Jun 22
5
has_many through , or habtm , using form
i think there ara two ways of relate products and categories ,
basically i want to fix one product(e.g hp dv7....) to some categories
(notebook,17"notebooks...)
i made a table named categorization(incuding category_id,product_id
fields) then in models i write these codes below
class Product < ActiveRecord::Base
has_many :categories, :through => :categorizations