Displaying 20 results from an estimated 4000 matches similar to: "fields_for in a form_for_remote?"
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2009 Oct 15
1
fields_for weirdness
I just did a large upgrade to to Rails 2.3.4 and I am trying to make
use of the more modern view features.
I have a Newsletter object. Newsletter has many Sections.
I also have:
accepts_nested_attributes_for :sections
on the Newsletter object.
I have the typical scaffolded new.html.erb with:
<% form_for(@newsletter) do |f| %>
in there, I am trying to populate the first Section
2011 Apr 04
1
Best way to instanciate an empty address element in many nested fields_for
Hi!
I have 3 models, User, Company and Address.
Basically, a User belongs to a Company and an Address has one Company
(because it can be linked to other models).
In a form I want to display a User, its Company and its company Address,
with fields_for.
The problem is when my User has a Company, that does *not* have an Address:
the part containing the Address is not displayed.
I see 2 ways of
2008 Dec 02
4
Am I wrong or is fields_for not working right in Rails 2.2.2
I may be totally wrong about what the fields_for method is supposed to
do, but for some reason I thought using it scoped an object around an
association.
For example, I have a User class and when you''re creating a new user I
want to use fields_for to add a BillingAddress to the user like so:
<%- fields_for :billing_address do |billing_address_form| -%>
<%= render :partial
2008 May 02
1
names of select elements inside a fields_for block not generated as expected
Hey All,
I''m trying to play along w/the ''complex forms 1'' railscast
(http://railscasts.com/episodes/73) and having trouble. The view is
projects/new. I''m trying to add some project_people to the form w/code
like so:
<% form_for(@project) do |f| %>
[project stuff here]
<% for pp in @project.project_person %>
<% fields_for
2011 Jul 25
4
[Rails 3.0.9] I have trouble about fields_for
Hi,all. I''m new bee to Rails and I have trouble about fields_for
method..
It isn''t show up between the <%= f.fields ~ <% end %>
Please teach me some advice.
Thanks!
#new/_form.html.erb
<%= form_for(@user) do |f| %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<!-- Below
2006 May 16
1
fields_for giving undefined method exception
I''m getting an undefined method exception with the fields_for method.
I''m following the gem examples. The form_for works but when I add
fields_for it breaks.
Are there other examples of how this works anywhere?
--
Posted via http://www.ruby-forum.com/.
2012 Jan 20
3
Fields_for adding html (text) for hidden field
Hello all,
I''m getting this weird ''<input name value=''2'' type=''hidden'' />'' text
printed out in my form. See attached image. I''ve spent too much time
trying to figure it out already and it''s not going to stop me from
moving on for now.
As you can see it''s still very early on.
I''m using
2013 Dec 10
2
form_tag + fields_for Rails 4
Hi There,
I''m trying to user fields_for inside a form_tag, but i can''t catch it
on my controller.
I just take some html code off to makes it easy to read
my view...
i''m using campuses_path(current_church, @campus) instead form_for
@campus, because my route is like
resources :campuses, :path => ":church/campuses"
<%= form_tag
2009 Feb 09
2
how to get form parameters while using fields_for with nested attributes
hi all..
i am trying to use *fields_for* to get and save nested attributes in a form.
i have a ''Partner'' model associated with an ''Address'' model.
partner has_many :addresses
although the form is displaying fine, but on submitting it the following
error is shown:
*can''t convert HashWithIndifferentAccess into Array*
on this line:
*@partner =
2012 Aug 16
6
undefined method `with_indifferent_access' for "":String
Hi
I''m having a issue with one object when try to update the attributes in
this object previously saved in the database
I have one object comp and one object reg they have this relationship
comp
has_many regs
reg
belongs_to comp
when run use the method valid? like this
current_contribuyente.comps.build(params[:comp]).valid?
it returns: IndexError (string not matched)
And when
2007 May 09
1
How can I change a form's onsubmit event handler using rjs?
Hi all,
I have a ajax form creating by "form_remote_for", whose url is to
create a new model by default. The page doesn''t change after the ajax
call on submit button so the form is still there after the new model
is created. But if I submit the form for the second time, I want to
update the formerly created model using an Ajax post.
I think I could render an rjs at the end of
2010 Aug 01
0
fields_for can not group its params when ajax
hi
book and page is one_to_many relationship.I want to create them in a
single form.But when clicking create button,the submitted params for
pages are not grouped correctly,
i want
"book"=>{"new_pages"=>[{"name"=>"", "color"=>""},
{"name"=>"","color"=>""}]
but it is
2010 Nov 28
6
has_one accepts_nested_attributes_for fields_for NOT WORKING HELP
MODEL
class User < ActiveRecord::Base
has_one :address, :dependent => :destroy
accepts_nested_attributes_for :address
end
CONTROL
def new
@user = User.new
@user.build_address # Adicionei
...
VIEW partial _form
....
<% f.fields_for :address do |b| %> # Adicionei
<%= b.text_field :city_manual %> # Adicionei
<% end %>
2009 Feb 10
2
form_remote_for NOT passing param: I want put and I get post
Hello,
I''m struggling my brain with this ajax issue ...
Basically I have a form for creating records, and I want to submit it
using Ajax.
On previous versions of RoR (2.0.2) it was working, but the same methods
doesn''t work on 2.2.2, and I started to make changes and changes and
read forums and the api, but no way ...
<% form_remote_for (:expedient, :url => {:action
2007 Apr 25
2
form_remote_for, reloaded
Hi,
being relativly new to RoR, I''m having a problem which I found described
in this forum and somewhere else - but with no solution. I know, that it
may be bad to mix table and form tags, but the first solution of an in
place editing within a table looked nice:
Version using form_for:
<tr>
<%form_for :time_record, :url => { :action => "add_time_record" } do
2008 Jul 14
5
How can i use link_to_remote with in form_for
Hi
anybody plz help me how can i use link_to_remote with in form_for.. i
tried but no luck... if i use form_tag i can able to use link_to_remote
and made ajax call.but i need to use form_for ....can anyone help me how
can i do with this.Thanks in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2007 Jul 14
3
observe_field, does this generate HTML?
I don''t have Rails installed at the moment, I''d like to check myself,
but it''s just a simple curiosity.
observe_field fits into replacement tags <%= %>, which caught my
attention because as far as I know it''s just javascript observing a
field and should not stick anything into HTML. Is <%= merely used as an
enabling method, or will there actually be
2008 Dec 21
1
Form issues : partials + AJAX vs simple JS / separate views + form_fors vs one view and fields_fors
Hi all!
I am coding an application that keeps track of request to create
college courses. An identified user (logically a faculty member)
completes a form indicating the name of the course, the professor in
charge, the course''s code, the date and place, the possible
coprofessors and TAs and the type of website he or she wants to use as
a teaching help (WebCT, Sakai, etc.).
I have two
2006 Aug 14
1
What fields_for really for?
Hello everyone!
I have 3 models:
=== 1 ===
class Region < ActiveRecord::Base
has_many :districts
end
=== 2 ===
class District < ActiveRecord::Base
belongs_to :region
has_many :suburbs
end
=== 3 ===
class Suburb < ActiveRecord::Base
belongs_to :district
validates_numericality_of :region_id, :only_integer => true
end
In edit.rhtml for SuburbController I need to specify