Displaying 2 results from an estimated 2 matches for "routley".
Did you mean:
rootlen
2006 Feb 17
7
Create and then show
I am attempting to redirect to the show method after creating a new
object. So, for example, once a new post is created the user is
presented with the new post in a show view. The problem is I can''t get
the correct <at> post.id to send to the show method. Rails always
returns 0 for this value.
Here''s what I have so far:
class ContentController < ApplicationController
2006 Feb 24
2
sqlite sets a new model''s id to 0 after a save
Example:
car = Car.new
car.id # is nil
car.save
car.id # is 0
I''m wondering if this is expected behavior, or something wrong with
what I''m doing. If it is not expected behaviour, how do I go about
solving it?