我的方法:紅寶石 - 方法參數
def my_method=(attributes, some_option = true, another_option = true)
puts hello
end
當我嘗試打電話,我得到這樣的錯誤:
my_method=({:one => 'one', :two => 'two'}, 1, 1)
#you_code.rb:4: syntax error, unexpected ',', expecting ')'
#my_method=({:one => 'one', :two => 'two'}, 1, 1)
^
什麼問題?
那你覺得這個怎麼樣[軌道屬性=方法(http://api.rubyonrails.org/classes/ActiveRecord/Base.html#method -i-attributes-3D)? –
@VladimirTsukanov已更新 – ShiningRay
@VladimirTsukanov並且「guard_protected_attributes參數現在已被棄用」 – ShiningRay