Displaying 5 results from an estimated 5 matches for "subcategory_id".
2006 Mar 30
5
Heeelp - no idea what''s going wrong.
...%= 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 %>
> <%= subcategory.name %>
</div>
<% end %>
<% end %>
This is the controller code for create:
def create
@listing = Listing.new(params[:listing])
@listing.categories = Category....
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
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
2006 May 23
7
has_and_belongs_to_many question
Hello,
I am trying to make the "switchover" to programming my apps in Rails and
have a question about database structure.
In the past i would structure a many to many like this:
categories
----------------------------------------------------
| id | name |
----------------------------------------------------
1 Some Category
2 Another
2009 Apr 05
5
Use a value from a different model
...default sort
@saving = Saving.search(params[:search], params[:page], sort_order)
end
end
the saving model (saving - table name = savings):
class Saving < ActiveRecord::Base
validates_presence_of :supplier,
:a_saving,
:a_spend,
:country_id,
:category_id,
:subcategory_id,
:buyer,
:purchaseType_id,
validates_numericality_of :a_saving, :a_spend
belongs_to :category
belongs_to :purchaseType
belongs_to :subcategory
def self.search(search, page, sort_order)
search=''%'' if search=='''' || search==''Type you...