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

On 17 March 2012 18:47, Shaban K. [email protected] wrote:

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?

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

On 18 March 2012 10:10, Shaban K. [email protected] wrote:

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 P. wrote in post #1052134:

On 18 March 2012 10:10, Shaban K. [email protected] wrote:

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?

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

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.

On 22 March 2012 08:25, Shaban K. [email protected] wrote:

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


Posted via http://www.ruby-forum.com/.


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


gplus.to/clanlaw

On 18 March 2012 11:10, Shaban K. [email protected] wrote:

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

with the next exercise.

Posted via http://www.ruby-forum.com/.


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


gplus.to/clanlaw