Sunday, December 16, 2012

Re: [Rails] Re: save 2 value in diffrent field in one field at database

On 16 December 2012 06:31, Mas Bejo <lists@ruby-forum.com> wrote:
> i edit my model file to be like this:
>
> class Anggotum < ActiveRecord::Base
> set_table_name "anggota"
> attr_accessible :NP, :Nama, :Alamat, :TTL, :Telp, :Email, :Password,
> :Waktu_Daftar, :Posisi, :Jenis_Kelamin
> serialize :TTL
> string "tempat"
> date "tanggal"
> #{':TTL'} << #{'tempat'] + #{'tanggal'}
> end
>
> and change the field in _form.html.rb file to be like this:
> ....
> <div class="field">
> <%= f.label :ttl %></td><td>
> <%= f.label :":" %></td><td>
> <%= f.text_field 'tempat' %>
> <tr>
> <td colspan="3" align="right">
> <%= date_select 'tanggal', 'tanggal', {:start_year => 1950, :order
> => [:month, :day, :year]} %>
> </div>
> ........
>
> rails say this error
>
> "NoMethodError in AnggotaController#index
>
> undefined method `key?' for nil:NilClass"

Have a good look at the Rails Guide on Debugging. It will show you
how to debug your code.

Also I suggest that you work right through a good tutorial on Rails,
such as railstutorial.org, which is free to use online. Then you will
get a better understanding of how Rails works.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate