Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Manipulate HABTM relationships in views
Hugues Brunelle
6/13/2009 4:51:00 PM
Hi everyone.
I'm currently working on a bodybuilding supplement Website which have 3
models :
* Stack :
has_and_belongs_to_many :products
* Product :
has_and_belongs_to_many :stacks
has_and_belongs_to_many :ingredients
* Ingredient :
has_and_belongs_to_many :products
Now what I am trying to do is list all the ingredients for a Stack
(using standard params[:id]). It seems that I cannot pass multiple
product_ids (but one id work fine!) to get the ingredients listing.
Here's a partial code from my controller :
=== START ===
def stack
begin
@stack = Stack.find(params[:id])
render :template => "public/stack_#{@lang}"
rescue ActiveRecord::RecordNotFound
logger.error("Attempt to access invalid stack #{params[:id]}")
flash[:notice] = "Désolé, cette formule est introuvable."
redirect_to :action => :index
end
end
=== END ===
Any help would be appreciate and I can provide more information if my
request isn't clear enought.
I am using RAILS_GEM_VERSION = '1.2.6'
Thanks
Hugues
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Manipulate HABTM relationships in views
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password