SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Formerly known as RockNRollPig Shpigford's Avatar
    Join Date
    Dec 2002
    Denver, CO
    0 Post(s)
    0 Thread(s)

    Problem with validates_presence_of

    I'm getting the following error:
    Validation failed: Price can't be blank, Title can't be blank, Description can't be blank, Sku can't be blank
    It's not returning that info to's just throwing a "fatal" error.

    Price, Title, Descripiton, and Sku are definitely getting passed though:
    {"commit"=>"Add Product",
     "title"=>"Petmate Durabed Large",
     "description"=>"Durabed is made from metal tubes and durable fabric cover. It is not a pillow,
     nor a basket. It's a frame bed. High side walls to cuddle up against. Padded board keeps the 
    platform straight to protect the dog's spine. Rectangular design saves space and holds 30 to 75 pounds. 
    This bed is approximately 6 to 7 inches off the floor. Machine washable. This is a large size measuring 25\" x 32\".",
    Any ideas why validates_presence_of would be doing this? validates_presence_of works fine in other models.

  2. #2
    SitePoint Enthusiast AllTom's Avatar
    Join Date
    Feb 2008
    Wherever danger lies...
    0 Post(s)
    0 Thread(s)
    Calling a method like save! or create! with a bang will cause it to throw errors instead of simply returning false.

    The hash that you pasted is params, right? And you initialized a Product with params["product"] when you got the error? Can you provide the code surrounding this? What is the fatal error, and what is the method from which it is thrown?
    There are some things you shouldn't try to code at home.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts