2013-05-10 18 views
0

我有這樣的規範方法和我想使用的地址參數來改變@ profile.website屬性導軌我該如何使用參數用於更新記錄屬性

def should_validate_length_of(adress) 
    @profile.adress = "x" * 393 
    @profile.save 
end 

should_validate_length_of('website') 

但我遇到這種undefined method ADRESS ='`

該解決方案應該很容易,但我不知道它。

回答

0

試試這個:

def should_validate_length_of(adress) 
    @profile.update_attributes(address => ("x" * 393)) 
end 

should_validate_length_of('website') 
相關問題