Rick Denatale wrote: > On Tue, Aug 25, 2009 at 1:45 PM, Dhaval > Phansalkar<[email protected]> wrote: >> in advance. > I beleive that you need to create the categorizations yourself > something like (this is untested): > >> class UsersController < ApplicationController >> �def new >> � �...@user = User.new >> � �...@apps = App.find(:all) >> �end >> >> �def create >> � �...@user = User.new(params[:user]) > params[:user][:app_ids].each do | app_id| > @user.categorizations << Category.new(:app_id => app_id) > end >> � �[email protected]! >> � �redirect_to(:action => "new") >> � �flash[:notice] = "Thanks for signing up!" >> � �rescue ActiveRecord::RecordInvalid >> � �render :action => 'new' >> �end >> end
> Rick DeNatale Thanks Rick. That worked. i thought join table might get updated automatically after mentioning the r'ship in models. only 1 change in ur code, Category shd be replaced with Categorization. Thanks once again :) -DPP -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

