Yes, i've seen that before: the postgresql constraint is correct and leave it there, it's good. What the database is telling you is that category nÂș 20 is not in the database. So, probably that category got deleted between the list view and the create recipe form. That usually happens when you tweak the data from a database client, the web browser and/or rails console, and integrity doesn't match between each other. Refresh the page and be shure to handle the data form one source and check if it happens again
On Fri, Jun 26, 2009 at 3:44 PM, amfeld20 <[email protected]>wrote: > > I created the database with Rails. > > I also figured out how to fix the create action for recipes - I > deleted the foreign key constraint in postgres, but I still get those > RJS errors when creating or updating recipe objects. Has anyone ever > encountered this before? After clicking "create" or "update," a window > pops up with the RJS error, but clicking "Okay" and returning to the > list shows that the recipe was indeed created or updated. > > On Jun 26, 1:05 pm, "G. Sobrinho" <[email protected]> wrote: > > Do you created the database with Rails or are you using a "legacy" > database? > > > > 2009/6/25 amfeld20 <[email protected]> > > > > > > > > > > > > > Hi all, > > > > > I'm having trouble with the create action. I'm getting this error > > > right after clicking "Create" > > > > > Request Failed (code 500, Internal Error) > > > > > After more searching, it seems the record shows this is the problem: > > > > > PGError: ERROR: insert or update on table "recipes" violates foreign > > > key constraint "recipes_category_fk" > > > DETAIL: Key (id)=(20) is not present in table "categories". > > > > > (In my models, a recipe belongs_to a category, and a category has_many > > > recipes. A recipe also validates_presence_of a category). > > > > > Any thoughts on what I should do? > > > > > Next, with the update action, as I try to change attributes of a > > > recipe, the changes will go through, but not before a window pops up > > > with this error: > > > > > RJS error: > > > > > TypeError: $$("#recipes-update-4-form a.cancel").first().link is > > > undefined > > > > > This one I'm a little less sure where to start looking. Any help > > > would be much appreciated! Thanks! > > > > -- > > Regards, > > > > Gabriel Sobrinho > > E-mail: [email protected] > > Phone: +55 31 8775 8378 > > > > Don't print this e-mail. The nature is thankful and your money also. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
