simple_fields_for help

54 views
Skip to first unread message

Brent Brent

unread,
Sep 2, 2013, 2:28:43 PM9/2/13
to rubyonra...@googlegroups.com
hello folks
Im trying to populate a text_field with a simple_fields_for and it
works as expected for the collection of data but at the end i always end
up with a empty text_field where i could input data, how do not display
the empty text_field. Here is a stub of what im trying to do in haml

= f.simple_fields_for :favorite_places do |fav|
= fav.label :state_name
= fav.text_field :favorite_state, :as => :string


which shows in html like so

state name
Chicago

state name
Denver

state name
--> empty text_field here to input some state

ive tried checking not sure what to check such as

- if :favorite_places.empty? || :favorite_places.blank? etc etc

any help would be appreciated

--
Posted via http://www.ruby-forum.com/.

Brent Brent

unread,
Sep 2, 2013, 3:40:48 PM9/2/13
to rubyonra...@googlegroups.com
dont worry just got my fix

this worked

= fav.label :state_name if !fav.object.id.nil?
Reply all
Reply to author
Forward
0 new messages