Displaying 20 results from an estimated 4000 matches similar to: "Nested models and forms"
2009 Jun 29
0
Problem with 2.3 nested forms and new elements
Hi,
I''m using the new nested forms functionality and I having problems with
new created elements.
I have an invoice with lines. I would like to be able to create a new
invoice, in the same form insert new lines dinamically and saving the
invoice and the lines when everything is validated, not before.
The problem is that when I add a line dinamically to the form, the new
line created
2009 Aug 23
0
Best way of moving some jQuery from a view helper
I have a helper that uses some jQuery code that I would like to move out
of the helper method.
I am trying to move it to application.js but it will probably end up in
a different file.
I have two reasons for wanting to do this.
1) I want to keep all my jQuery code seperate to my HTML code
2) I want to change the append to an appendTo so I can add a highlight
effect, appendTo which is proving
2006 Jun 07
0
using inline insert_html to generate uniquely named elements
Hello all,
I?m using some inline rjs to add content with a unique id like so:
In the <head>:
function add_fields() {
html = ''<div id="'' + new Date().getTime() + ''">'';
html += "<%= escape_javascript(render :partial => ''field_set'')
-%></div>";
new Insertion.After("whatever", html);
}
In
2008 May 26
7
Mocking Models in Controller Specs...
I find myself doing this kind of thing a lot in Controller Specs:
@vacancy = mock_model(Vacancy)
@vacancy.stub!(:reference)
@vacancy.stub!(:title)
@vacancy.stub!(:created_at)
@vacancy.stub!(:updated_at)
@vacancy.stub!(:body)
@vacancy.stub!(:contract)
@vacancy.stub!(:location)
@vacancy.stub!(:salary)
@vacancy.stub!(:benefits)
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 =
2011 Nov 04
1
add dynamic nested attributes without nested form gem
Hello people
In my rails 3.0.9 app I''m trying to add nested attributes
dynamically, but I don''t want to use "nested form gem"
So I found this example
https://github.com/alloy/complex-form-examples/blob/a234fde4419836f277d7e340657f1d8418911d68/app/helpers/projects_helper.rb
but this code doesn''t work
module ProjectsHelper
def
2013 Sep 07
0
[shoulda-matchers gem] validate_numericality_of_matcher strange behaviour
Hello
I have Vacancy model and vacancy_spec test with validates_numericality_of
:salary, greater_than: 1 in the model and
validate_numericality_of(:salary).is_greater_than(2) in the _spec.
When i run rspec spec command tests pass (in some cases and in other they
don''t)
Why?
vacancy.rb
------------------------
class Vacancy < ActiveRecord::Base
validates_presence_of :name,
2007 Dec 06
0
Stange behaviour with internet explorer
Hi!
I''m developing an application with Rails 1.2.6 and I''ve facing a weird
problem.
In a form, I''m using link_to_function that is aggregating a :partial,
the code is as follows:
<table>
<thead>
<tr>
<th>Marca</th>
<th>Porcentaje</th>
<th>Objetivo Mensual</th>
2011 Apr 06
1
Xen page sharing
Hi sahil:
I think the reason why you cannot get page shared is due to the gref you got.
Gref is responsible for a page allocated from domU, in my understanding it should not be
0, that is a gref 0 can not be shared, that''s why I skip gref 0 to be nominated.
The gref is nominated to Xen and later used to find a corrspond MFN, so it shall not always be the same.
2014 Aug 01
1
CentOS-docs Digest, Vol 93, Issue 1
Thanks For support.
One more doubt is that , As Centos 7 major release is launched , now
support for centos 6.x where x is latest mirror point release is supported
or not ? ? and further 6.y where y>x will be released or not .
You are requested to calrify .
On Fri, Aug 1, 2014 at 5:30 PM, <centos-docs-request at centos.org> wrote:
> Send CentOS-docs mailing list submissions to
>
2009 Sep 04
2
escape_javascript error
Hello,
I am using jQuery for all ajax stuff and recently got following error:
ActionView::TemplateError (private method `gsub'' called for #<Array:
0x2425ae8>) on line #1 of...
and the code where it happens:
$("#notice_ajax").before(''<div id="notice_ajax"><%= escape_javascript
(flash.delete(:notice)) %></div>'').remove();
2006 Nov 04
0
stumped trying to escape javascript
So I''ve got a few forms that update info using Ajax and
form_remote_tag. I''ve got a javascript function that I call from
within my render method in my controller, to take the contents of the
flash and display them in a div that appears and then disappears. I''m
using the following:
render :update do |page|
page << ''ShowMessage("''
2012 Feb 17
0
Passing a value to js.erb
Rails 3.1.3
I''m trying to pass a value to ''save.js.erb'' .
in the view, I have put
<%= hidden_field_tag "video-id", @video.id, { :id => "video-id" } %>
then, I can retrieve it by
var idval = $(''#video-id'').val();
It certainly gets the value.
The problem is then I need to pass it to the following.
I tried,
2010 Dec 21
8
Rails - escape_javascript without all the \n\n\n\n\n
Hello, I''m using escape_javascript to return a partial to the browser
via ajax.
Something like:
$("#inject").html("<%=escape_javascript(render :partial =>"feed/
index")%>");
Problem is escape_javascript ends up outputing all kinds of wasted
space like
\n\n\n\n\n \n
Is there anyway in Rails to escape_javascript more
2009 Dec 06
3
link_to_function or button_to_function memory usage
I have an full ajax app doing crud operations for contact info for one
section. I was using ajax calls to edit and cancel and also to add a
contact. I am implementing a button_to_function instead of doing an
ajax call to just edit/add/or cancel a contact. I am running into a
memory issue using the button_to_function or link_to_function.
I have this:
<%= link_to_function ''Edit
2011 Sep 10
4
Finding HTML attributes with jQuery in Rails 3.1
I''m having trouble wrapping my head around the proper syntax to have
jQuery (in an .js file) grab an HTML attribute and use the value of
that attribute to load a partial.
HTML fragment:
<a href="/toggle" data-remote="true" section="training">
jQuery string (now setting a static partial, I need this to be
dynamic)
2006 Mar 18
2
Additional link tag attributes with link_to_function...
Hi,
I''m having a bit of a struggle with link_to_remote. Everything works
exactly as I want it, but the problem is that I want to add another
attribute to the <a>-tag, namely class="". Long story short, I want
specific links to look differently from others, but all of them being
link_to_function. Normally, I''d do this with adding a class="foo" to
2018 Mar 16
0
Improving "Control-Flow Select" Vectorization Remark
Hello all,
My name is Sahil Yerawar, Btech 3rd Year Undergraduate student at
IIT-Hyderabad. I am currently working on improving vectorization diagnostic
remarks in LoopVectorize.cpp. I have some familiarity with LLVM as we
studied it in Compiler Engineering Course at IITH.
Here is our first effort to improve one of the remarks.
https://reviews.llvm.org/D44067
You might want to have a look at
2011 Nov 29
1
ajax question
Hello,
could you please explain what''s wrong with this code:
Rails 3.1.1
skills_controller.rb
class SkillsController < ApplicationController
# GET /skills
# GET /skills.json
def index
@skills = Skill.all
respond_to do |format|
format.html # index.html.erb
#format.json { render json: @skills }
format.js
end
end
end
index.html.erb
<%=
2008 Jul 27
1
mail extra field to override default mail_location for only certain users
I am running version 1.1.1 with mail_location: maildir:~/Maildir. This is
working great as all our users have UNIX accounts with nologin shells. New
domains (and their users) are about to come online and we would like to
migrate to a setup with virtual mailboxes/users. From the wiki and comments
within dovecot.conf, I see it is possible to do this piecemeal so both local
and virtual users