我想要把那個 view 裏面地址這個欄位的顯示,轉存到另一個名為 address_full 的欄位去. 我查看了下 view.. 這個部份的程式是這樣寫的
<div class="field1">
<b>地址:</b>
<%= area_name(@kojenadult) %><%= @kojenadult.road_name %><%= @kojenadult.address %>
</div>
後來我將它寫到模組中
# encoding: utf-8
class Kojenadult < ActiveRecord::Base
before_save :student_id_to_sub_column, :filter_out_xxx_email, :address_to_address_full
protected
def address_to_address_full
self.address_full = :area_name(@kojenadult)#@kojenadult.road_name #@kojenadult.address
end
嗯?噴錯誤了..再幫我看下,這指令要怎麼寫
SyntaxError in KojenadultsController#search
/home/idarfan/kojenadults/app/models/kojenadult.rb:138: syntax error, unexpected '(', expecting keyword_end
...self.address_full = :area_name(@kojenadult)#@kojenadult.road...
... ^
Rails.root: /home/idarfan/kojenadults
Application Trace | Framework Trace | Full Trace
app/controllers/kojenadults_controller.rb:2:in `<top (required)>'