0
내가 Sign up
로 할 때 나는 오류 얻을 이유는왜 '정의되지 않은 메소드'가 simple_form과 hstore로 표시됩니까?
class User < ActiveRecord::Base
attr_accessible :email
validates :email,
presence: true
serialize :data, ActiveRecord::Coders::Hstore
end
및
<%= simple_form_for User.new do |f| %>
<%= f.input :email %>
<%= f.input :first_name %>
<%= f.input :zipcode %>
<%= f.button :submit, 'Sign up' %>
<% end %>
있습니다
undefined method `zipcode' for #<User:0x007fd397631650>
전체 추적 : https://gist.github.com/3c9df05758ea3d486989
우편 번호가'data' 해시의 속성입니까? 그렇다면이 방법으로 액세스 할 수 있다고 생각하지 않으며 simple_form이 직렬화 된 필드를 처리 할 수 있을지 의심 스럽습니다. 어쩌면이 스레드는 당신을 도울 수 있습니다 http://stackoverflow.com/questions/9613208/serialized-hash-field-and-simple-form –
그리고 그것이 작동해야하는 이유는 무엇입니까? – fotanus