Hi guys, I’m following the Beginning Rails 3 Book, I’ve problems with
the
many to many relationship between Article-Category, when I try to create
or
show a article.
Please help me, I’m new with Rails.
Regards,
ActiveRecord::StatementInvalid in Articles#new
Showing I:/Labs/RailsProjects/blog/app/views/articles/_form.html.erb
where
line #27 raised:
SQLite3::SQLException: no such column:
articles_categories.category_id: SELECT “categories”.id FROM
“categories” INNER JOIN “articles_categories” ON “categories”.id =
“articles_categories”.category_id WHERE
(“articles_categories”.article_id = NULL )
Extracted source (around line #27):
24: <%= f.label “Categories” %>
25: <% for category in Category.all %>
26: <%= check_box_tag ‘article[category_ids][]’, category.id,
27: @article.category_ids.include?(category.id), :id =>
dom_id(category) %>
28: <%= label_tag dom_id(category), category.name, :class =>
“check_box_label” %>
29: <% end %>
30:
Trace of template inclusion: app/views/articles/new.html.erb
Rails.root: I:/Labs/RailsProjects/blog
Application Trace http://localhost:3000/articles/new#
| Framework Trace http://localhost:3000/articles/new# | Full
Tracehttp://localhost:3000/articles/new#
app/views/articles/_form.html.erb:27:in `block (2 levels) in
_app_views_articles__form_html_erb___743271537_14143752__942053146’
app/views/articles/_form.html.erb:25:in `each’
app/views/articles/_form.html.erb:25:in `block in
_app_views_articles__form_html_erb___743271537_14143752__942053146’
app/views/articles/_form.html.erb:1:in
`_app_views_articles__form_html_erb___743271537_14143752__942053146’
app/views/articles/new.html.erb:6:in
`_app_views_articles_new_html_erb__987918893_24332892_280057368’
app/controllers/articles_controller.rb:20:in `new’
Request
Parameters
:
None
Show session dump http://localhost:3000/articles/new#
Show env dump http://localhost:3000/articles/new#
Response
Headers
:
None
–
TSU. Amador Cuenca