and from there followed the procedures listed at the site noted above
thru the end of Step 2 including creating another table (articles table
referred to in demo) with a user_id :interger column.
After creating a user I attempt to create and save an article
instance/record which fails at the
validates_presence_of :user
Can you see anything in the “demo/tutorial” code which is out of place
or have I missed some step required to get the session :user properly
assigned to the @article instance?
and from there followed the procedures listed at the site noted above
thru the end of Step 2 including creating another table (articles table
referred to in demo) with a user_id :interger column.
After creating a user I attempt to create and save an article
instance/record which fails at the
validates_presence_of :user
Can you see anything in the “demo/tutorial” code which is out of place
or have I missed some step required to get the session :user properly
assigned to the @article instance?
Thanks,
Bernie
Do you have a ‘user’ field on your Articles table?
I only skimmed the start of the post, but my first thought is that the
articles table should have a ‘user_id’ field, not a ‘user’ field, to
link Articles to Users through the has_many/belongs_to associations, and
then the line should be:
Also in the tutorial articles_controller there are references to @article.user and @session[:user]. Should these not be .user_id as
well? (pardon my noobiness)
Have a look to the session[:user] and so on, I think Login-generator
puts the values with ‘’ (e.g. session[‘user’]), and you articles or some
other stuff may be asking for session[:user]
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.