Displaying 20 results from an estimated 1000 matches similar to: "adding habtm through migrations"
2006 Jul 30
1
Doubt on composite index
The AWDwR book has the following:
add_index :categories_products, [:product_id, :category_id]
add_index :categories_products, :category_id
The first, composite index actually serves two purposes: it creates an index which can be searched
on both foreign key columns, and with most databases it also creates an
index that enables fast lookup by the product id. The second index then
completes
2006 Jul 07
2
many-to-many error
hey all. I''m trying to set up a many-to-many relationship with products
and categories.
I''ve got the product model (product.rb) set up:
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
end
and a similar one for category.rb
And I''ve got the tables set up -- products, categories,
categories_products
But when I load, I get: undefined method
2006 Jun 14
3
Prevent duplicate HABTM associations
Hi,
I am trying to restrict duplicate has_and_belongs_to_many associations.
I tried to find support for a association validation for duplicates but
couldn''t find anything.
I understand I could use :uniq=>true on the model association but this
would only prevent it from displaying duplicates, I want to stop
duplicate associations being inserted in the first place.
I have a vague
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
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",
2006 May 28
7
Join table not being populated
Hello,
I have the usual Categories and Products table scenario, mediated by a
Categories_Products join table. When I create a new Product and into a
given Category, I notice that my join table is not being populated.
Shouldn''t the join Categories_Products table be populated?
Thanks,
gk
--
Posted via http://www.ruby-forum.com/.
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
2012 Sep 13
10
access key error
I am getting following error while run my rails app in my server
ActionView::Template::Error (You did not provide both required access keys.
Please provide the access_key_id and the secret_access_key.):
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2005 Jun 03
1
sorting on a habtm relationship
I have two tables ("products" and "categories") that have a
has_and_belongs_to_many relationship, and I need to be able to
arbitrarily sort products in the scope of a category using something
like acts_as_list. Problem is, since each product can belong to
multiple categories, it doesn''t work to use acts_as_list and have the
"position" field be in the
2013 Nov 10
3
accepts_nested_attributes_for how, example
I have following tables with following models:
users(id, role_id) *has_many :entries*
categories(id, category_name) *has_many :entries*
entries(id, category_id, user_id) *belongs_to :user, belongs_to
:category, has_one :storage*
storages(id, title, content, entry_id)* belongs_to :entry*, *has_one
:vote*
votes(id, count, storage_id) *belongs_to :storage*
Now,
2005 Aug 15
0
RE: has_many_belongs_to_many insert issues [CLOSED]
Found the issue.
In the association table (categories.products) it is very important to
use lowercase column names.
I.e, product_id and category_id.
I had Product_id and Category_id in SQL....
Gildas
-----Original Message-----
From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Cherruel,
2006 May 01
4
Find rows with associations in habtm
This may have been asked/answered before - if so, i apologise...
I have the following table layout in a habtm relationship:
------------ ----------------------- --------------
| products | ----| categories_products |-----| categories |
------------ ----------------------- --------------
What would be the best way to pull out all the products for a given
category? At the
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 May 16
25
Ruby on Rails Searchable and Annotatable Docs
I recently updated my Rannotate application. The interface has been
completely redone and there are lots of new features. The basic idea is
to create searchable and user annotatable documentation for the Ruby on
Rails API (think php.net).
Check it out at - http://rails.outertrack.com
* What is Rannotate?
Rannotate is a Rails application and RDoc YAML generator that work
together to provide
2003 May 24
2
advantages of a sip phone over Wildcard TDM400P solution
Hi,
after finally getting my testsystem to work well I'm planning to buy
some hardware. Now I was wondering what the advantages / disadvantages
of using a Wildcard TDM400P solution over using real sip phones like the
snoms is? The only thing I came up with is that the Snoms can use a LDAP
adressbook on the server. What about calling a sip adress like
person@server.com. Can this be done by
2006 May 28
9
Railsmanual.org
Did anyone else catch the redesign? I don''t know who''s responsible, but it''s
lookin better!
Good job...
--
seth at subimage interactive
http://www.subimage.com/sublog/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060528/f9f92618/attachment.html
2006 May 23
8
ad-hoc query
How do you run an ad-hoc query that does not belong in any model? I
thought it was something like ActiveRecord::connection.find("my
query..."), but I can''t seem to find the documentation on it. I know
I''ve seen it somewhere before, though.
thanks,
Jeff
--
Posted via http://www.ruby-forum.com/.
2008 Jun 10
5
Rails params parsing bug?
I have a form that sends the following query string to my Rails
controller:
transaxion[category_association_attributes][][category_id]=2&
transaxion[category_association_attributes][][amount]=12&
transaxion[category_association_attributes][][category_id]=1&
transaxion[category_association_attributes][][amount]=8
But ActionController parses it as:
2006 Sep 28
15
Inserting rows into linking table
Hi,
I have two objects:
Contacts
Lists
I want to be able to add multiple contacts to multiple lists.
I''ve created a linking table and a form that allows me to select the
contacts using checkboxes, but I''m having some problems with the
controller and model.
I receive the following error message when I submit the form:
Mysql::Error: Cannot add or update a child row: a
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)