Displaying 20 results from an estimated 900 matches similar to: "accept_nested_attributes, reject_if doesn't work."
2009 Jun 24
1
accepts_nested_attributes_for :reject_if issue
I have the following models:
class Order < ActiveRecord::Base
belongs_to :billing_address
belongs_to :shipping_address
accepts_nested_attributes_for :billing_address
accepts_nested_attributes_for :shipping_address, :reject_if => proc {
|attributes| attributes[''has_shipping_address''] != ''1'' }
def after_initialize
self.build_billing_address
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2013 Mar 30
1
How to use group in nested associations
The below query fails:
Timesheet.joins(:time_entries).select("timesheets.*,
sum(time_entries.worktime) as total").group("timesheets.start_date")
The models have the following relations:
Timesheet < AR
has_many :activities, dependent: :destroy, inverse_of: :timesheet
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities,
2013 Feb 27
0
Exended modules and reject_if in nested_attributes
I have some common class methods in a module ''active_record_additions''
that I load into a class by Activity by using extend ActiveRecordAdditions
The Activity class uses nested_attributes_for with a reject_if method saved
in the module ''active_record_additions''
The problem is that the class methods in ''active_record_additions'' works
when I
2010 Feb 06
1
accepts_nested_attributes_for with has_many => :through
I have two models, links and tags, associated through a 3rd model,
link_tags. I added the following to my link model,
has_many :tags, :through => :link_tags
has_many :link_tags
accepts_nested_attributes_for :tags, :allow_destroy => :false,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? } }
and put this in a partial called by the new and edit forms for links,
2010 Dec 09
2
Skip validation on nested attribute
Hi,
I have a two models, advert and address.
An advert has one address.
On my advert form I have a nested form of the address. But I only want
to create the nested address depending on the adver kind.
how can I skip the nested attribute validation?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2013 Nov 10
3
accepts_nested_attributes_for how, example
I have following tables with following models:
users(id, role_id) *has_many :entries*
categories(id, category_name) *has_many :entries*
entries(id, category_id, user_id) *belongs_to :user, belongs_to
:category, has_one :storage*
storages(id, title, content, entry_id)* belongs_to :entry*, *has_one
:vote*
votes(id, count, storage_id) *belongs_to :storage*
Now,
2009 Nov 06
0
Nested objects not propagating from view
I thought I had this fixed, but apparently not. It works okay from the
console, but not from the view. I have the following:
# partial schema
create_table "users", :force => true do |t|
t.string "login", :null => false
t.string "first_name"
t.string "last_name"
t.string "email", :null => false
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all,
After many days of struggling, I have a multi-model form with ajax
elements more or less working, but I''m hitting a wall with a few bugs
that I can''t figure out. Guidance would be very much appreciated.
I''m using the Ryan Bates technique from Advanced Rails recipes to
dynamically add and remove elements on a multi-model form.
2011 Sep 27
0
accepts_nested_attributes_for is not working for uniqueness
class User < ActiveRecord::Base
accepts_nested_attributes_for :emails, :allow_destroy => true,
:reject_if => proc { |attributes| attributes[''address''].blank? }
end
class Email < ActiveRecord::Base
belongs_to :user
validates_presence_of :address
validates_email_format_of :address
validates_uniqueness_of :address,
1999 Sep 22
1
dates screwed up, help!
Hi, the problem I am reporting relates to RH Linux 6.0
I have successfully mounted a disk from a windows NT server machine,
using smbmount as follows:
$ smbmount //machine/service -c 'mount /mnt/NTgroups -u local_owner' -U
remote_username
and everything looked fine. Now I have just noticed that when "touching"
or creating files everything behaves strangely, that is the date is
2002 Oct 08
2
name_query failed to find name
Hello,
I am hoping someone can help me....
I am trying to configure my samba...and the problem is the following:
When I use nmblookup with -B option and Broadcast address it is
impossible to find my samba server (named prova) that is:
# nmblookup -B 10.254.14.127 prova
querying prova on 10.254.14.127
name_query failed to find name prova
If I do the same lookin up to another machine different
2007 Dec 03
3
overlapping labels
Good evening,
I am trying to add labels to the point of a simple plot, using the
text() function; the problem is that sometimes, if two points are too
close to each other, labels overlap and are no longer readable.
I was wondering whether there are options that I can use to prevent this
overlapping (by, for example, placing labels alternatively above and
below the plotted curve), or whether I
2001 May 31
1
Building shared libraries under Windows
I didn't manage to build a c shared library under Windows.
I used rcmd shlib both with a source file and with an object file, but I got error messages in both cases.
I get the same error messages both using a Dos shell and Cygwin.
If I use the source file, I type:
rcmd shlib prova.c
and what I get is:
make[1]: `libR.a' is up to date.
windres --include-dir
2013 May 29
1
Strange Beauvoir with hard and soft link
How to is possible this?
> [root at lucatest ~]# ls -lid /var/log /var/log/ispconfig /var/log/ispconfig/httpd /var/log/ispconfig/httpd/prova.it /var/log/ispconfig/httpd/prova.it/test /var/www /var/www/clients /var/www/clients/client1 /var/www/clients/client1/web3 /var/www/clients/client1/web3/log /var/www/clients/client1/web3/log/test
> 706 drwxr-xr-x. 15 root root 4096 29 mag 08:44
2002 May 10
2
RODBC for importing dbf
Hi
I know that it is very easy to import data from a dbf file to R, by
saving the data as csv, for instance.
However, I have several hundreds of files to do that. So, I thought of
using RODBC to read the dbf files and save it as data.frame. However, I
cannot even start (this is my first time using such package):
> library(RODBC)
> bdades <- odbcConnect("prova.DBF")
Warning
2007 Nov 15
2
counting strings of identical values in a matrix
Hello
I have this problem. I have a large matrix of this sort:
> prova
[,1] [,2] [,3] [,4]
[1,] 3 3 3 3
[2,] 3 3 3 1
[3,] 1 3 3 3
[4,] 1 1 1 3
[5,] 3 1 1 3
[6,] 3 1 1 3
[7,] 1 3 1 3
[8,] 1 3 3 3
What I want to do is to count the number of
sequences of ones and stack the results in a
2009 Jun 30
5
[Bug 1616] New: root owned empty subdirs are deletable by chroot users
https://bugzilla.mindrot.org/show_bug.cgi?id=1616
Summary: root owned empty subdirs are deletable by chroot users
Product: Portable OpenSSH
Version: 5.2p1
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: sftp-server
AssignedTo: unassigned-bugs at mindrot.org
2011 Feb 08
0
Sorting by inner has_many through attribute
Hello everyone,
For this model:
class User < ActiveRecord::Base
has_many :component_users, :dependent => :destroy
has_many :components, :through => :component_users, :conditions =>
[''components.active = ?'',true]
accepts_nested_attributes_for :component_users, :reject_if => lambda
{ |a| a[:components].blank? || a[:components]
[:name].blank? },
2005 Apr 07
1
how to print error message in batch mode
Dear list,
I am using R in batch mode:
$ R -q --no-save < prova > output
the input file "prova" has these commands:
data(USArrests)
x<-USArrests
hist(x)
of course, the command hist(x) produces an error. The error message is:
Error in hist.default(x) : `x' must be numeric.
Is there the possibility to save this error massage in the "output" file?
Thanks in