Simple thing but im not getting it -> params and @user

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

Post the code. Makes it easier to diagnose.

On Nov 23, 12:21 pm, Steve K. [email protected]
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 %> &nbsp;&nbsp;

<%= 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs