February 2010
4 posts
authlogic doesn't seem to like html multipart in...
xhr :post, :create, { :item_id => @item.id.to_param, :Filedata => fixture_file_upload('images/sample1.jpg', 'image/jpeg') }, :html => { :multipart => true }
fails
xhr :post, :create, { :item_id => @item.id.to_param, :Filedata => fixture_file_upload('images/sample1.jpg', 'image/jpeg') }
succeeds.
not going to track this one down, because my test was green...
Rails Routing Namespaces with Nested Routes can...
Working on my side project, I refactored some controllers into an admin namespace, resulting in a directory tree that looked something like this:
-controllers/
-admin/
-item/
-photo_controller.rb
-item_controller.rb
All the tests passed, yet whenever I hit my (previously working) admin/items controller, I got:
NoMethodError (undefined method `find' for Admin::Item:Module):
...
Active Record DB Types: A Reference
Native types:
add_column :native_type, :name, :options
:primary_key
:string
:text
:integer
:float
:decimal
:datetime
:timestamp
:time
:date
:binary
:boolean
Native Type Options:
:limit - Requests a maximum column length. This is number of characters for :string and :text columns and number of bytes for :binary and :integer columns.
:default - The columnās default value. Use nil...
has_many :through, accepts_nested_attributes_for,...
I had a need to write some code that would permit the following:
it "accepts attributes for item_photos" do
photo = Factory(:photo)
item = Item.create!(Factory.attributes_for(:item, :item_photos_attributes => [{:photo_id => photo.id}]))
item.item_photos.should have(1).item_photo
item.photos.first.should == photo
end
Basically, you can use nested attributes to when...