Hey there, i have a simple conflict about trying to pass control from one controller to another, but remembering which controller called it. ok, i have users. each user has_one :pref (prefs is stuff like phone, email, etc) each user also has_many :accounts so accounts and prefs belong_to :user what i am trying to do is test if a prefs row has been created for the user, if not, there needs to be a notification to create this row for the user. I got that, and when i have the link_to go to the pref_controller.rb, it works and the form from the scaffold loads ( i point it to the new action ) when i hit submit though, it tells me that it cannot find the user without id. i guess my question is, how do i pass the user info to the pref controller so that it knows to add the prefs record with the right user_id ? same with the accounts. thanks sk --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Steve Keener
2006-Nov-23 18:21 UTC
Re: simple thing but im not getting it -> params and @user
Post the code. Makes it easier to diagnose. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 23, 12:21 pm, Steve Keener <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Post the code. Makes it easier to diagnose. > > -- > Posted viahttp://www.ruby-forum.com/.OK, each Site has_many :site_notes each Site has_one :farm_stat each farm_stat belongs_to :site each site_note belongs_to :site ok in my site view i have this <%= if @site.farm_stat link_to "edit stats", :controller => "farm_stats", :action => "edit", :id => @site.farm_stat else link_to "create stats", :controller => "farm_stats", :action => "new", :id => @site end %> <%= link_to "site notes", :controller => "site_notes", :action => "index", :id => @site %> and i am wondering what to put in the scaffold of each to make sure that the Site is remembered when created as the owner / parent of that farm_stat or site_note farm_stats are only one per site and contain stuff like what crop, location, so on site_notes i intend to be just a note taking app where the user can add notes (almost like the blog app from the 15 minute tutorial ) so, i don''t know how to modify the code in my two scaffolds thanks --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---