On Aug 4, 2011, at 4:13 PM, Kendall Gifford wrote:
I'm gonna take a stab at this and say it's because you're not
posting a name parameter to the create action. Therefor, the create
action is trying to create a new Brand w/out a name. Since you're
using the friendly_id gem and configuring the Brand model to use its
"name" field as the friendly id, you must provide a name else you
get FriendlyId::BlankError.
Here's the fixture:
one:
name: MyString
image_file_name: MyString
image_content_type: MyString
image_file_size: 1
image_updated_at: 2011-08-03 10:49:03
tease: MyText
description: MyText
Doesn't really matter what you have in your fixtures since you're
simulating a request that results in a call to your #create action
in your controller which will create a new (blank) Brand record.
I've tried all sorts of variations on this, along the lines of
post :create, :name => 'MyString'
and
b = Brand.any_instance
b.stubs(:valid?).returns(true)
b.stubs(:name).returns('MyString')
post :create
and I've gotten the identical error.
Can you show me the correct way to write this, such that I define the
value for name at the correct moment?
Thanks,
Walter
--
You received this message because you are subscribed to the Google Groups "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.