Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

ruby - RSpec Active Record Scope -


i want write scope requires start date of products less today. wrote following in rspec

it "should not found start date in future"    @product.start_date = date.tomorrow    @product.save     product.active.find(@product.id).should == nil end 

that test fails, obviously. wrote scope-

scope :active, where('start_date <= ?', date.today) 

then rerun spec , fails with-

2) product should not found start date in future  failure/error: product.active.find(@product.id).should_not == true  couldn't find product id=1 [where (start_date <= '2010-12-20')]  # ./spec/models/product_spec.rb:168:in `block (2 levels) in <top (required)>' 

i cannot figure out how code pass. not want product found.

look @ error: "couldn't find product id=1", scope working. problem in test, find raises exception usual because no record has been found. either have use find_by_id or assert exception rspec.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -