Agile web development with rails 4th edition adding sizes to the product

Hi I am going through the Agile web development with rails 4th edition
book and I am trying to modify the depot application to allow the
customer to select a size before purchasing a product. What and how
would I have to modify the depot app to do this?

size of what exactly? of a product? If so, I guess you only have to add a row to your table

Better to work right through the tutorial first I think, then you will
probably know the answer without having to ask here. If you don't
know by then it is not much good as a tutorial.

Colin

I am sort of stuck doing this myself below is my code and I keep getting
this error "The action 'update' could not be found for
ProductsController" when I select the size and add the product to
basket. What am I doing wrong?

My source code is attached.

Thanks in advance

Attachments:
http://www.ruby-forum.com/attachment/7158/size.txt

What am I doing wrong?

You're not going through the whole tutorial, understanding it, and
then moving on to develop your own projects.

By all means twiddle with the example code, but always be able to get
back to how the book says it should be, or else you may have troubles
with the next exercise.

My source code is attached.

You're missing an "end" from your products_controller, but that
wouldn't cause the error message you describe; it's more likely a
cut'n'paste error... but if you make one pasting error.... you might
make more.
Also, do you intend to have two "Add to Cart" forms posting to different routes?

Hi I have gone through most of the tutorials but for my own project I am
trying to create my own e-commerce clothing site.

I only intend to post to one route , my mistake.

Michael Pavling wrote in post #1052134:

Hi I have gone through most of the tutorials but for my own project I am
trying to create my own e-commerce clothing site.

I only intend to post to one route , my mistake.

Have a look in development.log and see what it says when you submit
the form. If you still can't get it working post the full error
message.

Have you not noticed that those replying are inserting their replies
inline in the previous message? This should be a hint that you should
do this yourself. It makes it easier to follow the thread.

Colin

Have a look in development.log and see what it says when you submit
the form. If you still can't get it working post the full error
message.

Have you not noticed that those replying are inserting their replies
inline in the previous message? This should be a hint that you should
do this yourself. It makes it easier to follow the thread.

Colin

What I have now done now is add sizes to the products table and also to
the products controller to allow it to access the sizes which are
available , what I now get when I try to look at the product is this
exception: SQLite3::SQLException: no such column: sizes.product_id:
SELECT "sizes".* FROM "sizes" WHERE "sizes"."product_id" = 4.

All I want to be able to do is be able to select a size for the product
and add it to the shopping cart.

Attachments:
http://www.ruby-forum.com/attachment/7177/product_view.txt
http://www.ruby-forum.com/attachment/7178/products_controller.txt
http://www.ruby-forum.com/attachment/7179/line_items.txt

Have a look in development.log and see what it says when you submit
the form. If you still can't get it working post the full error
message.

Have you not noticed that those replying are inserting their replies
inline in the previous message? This should be a hint that you should
do this yourself. It makes it easier to follow the thread.

Colin

What I have now done now is add sizes to the products table and also to
the products controller to allow it to access the sizes which are
available , what I now get when I try to look at the product is this
exception: SQLite3::SQLException: no such column: sizes.product_id:
SELECT "sizes".* FROM "sizes" WHERE "sizes"."product_id" = 4.

It might be helpful if you told us which line of code is generating
that error. In fact it is always a good idea to show the complete
error message. Before that though look at the code and try and work
it out for yourself.

It seems to be expecting sizes to have a column product_id (but
presumably you had worked that out for yourself). Should sizes have
that column? If so then have you added the column?

Colin