Displaying 20 results from an estimated 4000 matches similar to: "Problem saving nested attributes for has_many associations (Rails 2.3 RC2 and Edge)"
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,
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,
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
2011 Feb 11
1
accept_nested_attributes, reject_if doesn't work.
class Post < ActiveRecord::Base
validates :name, :presence => true
validates :title, :presence => true,
:length => { :minimum => 5 }
has_many :comments, :dependent => :destroy
has_many :tags
accepts_nested_attributes_for :tags, :allow_destroy => :true,
:reject_if => proc { |attrs| attrs.all? { |k, v| v.blank? or v.nil? } }
end
rails c
2010 Jun 17
0
Edge Rails Nested has_many :through Association
So this functionality isn''t supported natively in Rails 3 (or any
versions before that for that matter) But I had found a work around
via this blog post: http://geoff.evason.name/2010/04/23/nested-has_many-through-in-rails-or-how-to-do-a-3-table-join/
This didn''t work on Rails 3 because it wasn''t able to properly build
the query from the join with symbols. I was
2006 Jun 13
0
question about saving associations when using has_many :through
I''ve got a User model and a Book model. A user is required to submit
books each month to be reviewed by other users. I have the following
relationships defined:
# the join model
book_review.rb
belongs_to :user
belongs_to :book
end
book.rb
# each book is reviewed by many users. This allows us to get the BookReview
# objects associated with this book
has_many :book_reviews,
2009 Apr 11
1
Error in R CMD check 2.8.1
Env: R 2.8.1, Win Xp, Eclipse/StatET
In a .Rd file, I have an example containing the lines:
# calculate Y M, using polynomial contrasts
trends <- as.matrix(VocabGrowth) %*% poly(8:11, degree=3)
colnames(trends)<- c("Linear", "Quad", "Cubic")
[At the risk of a long message, I'll append the complete .Rd file at the
end of this message, in case this was
2009 Apr 12
0
rails 2.3 nested forms with has_many through checkboxes
I was wondering if anyone knew of a way to combine the new nested
forms in rails 2.3 with a has_many through relationship via
checkboxes. Basically I have a page model, a page_category model and
a category_items join table. Pages have many page categories through
category items. The category_items table is polymorphic so i can use
it for other models who need categories (maybe this is
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:
2010 Nov 11
2
Rails 3 - Nested Forms, using Builder -- Check_box issue
Hello, I have the following:
My Controller:
def new
.
.
@teammembers.each do |teammember|
request = @request_thread.requests.build(:recipient_id =>
teammember.user_id, :full_name => ''Billy Bob T'')
end
My View:
.
.
<%= f.fields_for :requests do |builder| %>
<div class="field">
<%= builder.label
2007 Aug 18
2
Problem with lsa package (data.frame) on Windows XP
Dear R team,
The following piece of code (to use the lsa package) works fine on my
mac os x, but when I run the same code on Windows XP, it doesn't work
any more.
### code:
library("lsa")
matrix1 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE.
000\\LSA\\cuentos\\", stemming=TRUE, language="spanish",
minWordLength=2, minDocFreq=1,
2011 Nov 24
0
sem package (version 2.1-1)
Dear R users,
Version 2.1-1 of the sem package, for structural equation modeling, is now
on CRAN.
Unlike version 2.0-0, which was a major overhaul of the package, version
2.1-1 just sprinkles some syntactic sugar on it, introducing the
specifyEquations() and cfa() functions; specifyEquations() supports model
specification in equation (rather than path) format, and cfa() facilitates
compact
2011 Nov 24
0
sem package (version 2.1-1)
Dear R users,
Version 2.1-1 of the sem package, for structural equation modeling, is now
on CRAN.
Unlike version 2.0-0, which was a major overhaul of the package, version
2.1-1 just sprinkles some syntactic sugar on it, introducing the
specifyEquations() and cfa() functions; specifyEquations() supports model
specification in equation (rather than path) format, and cfa() facilitates
compact
2010 Nov 28
2
program problem
Hello everyone!
I can not install a program with wine. I have version 1.2 of wine and I can not install an Italian vocabulary. this is the vocabulary Garzanti(I've downloaded on ISO hunt). I installed, but it opens and then tells me that something is wrong in wine,some problems with the library?
could someone help me?
2004 Jan 30
1
Words for Allison(?)
I've been looking at the weather vocabulary in asterisk-sounds in CVS.
I've run into a few hitches with words I can't seem to find. So far, I'm
looking for 'point' (for constructing floating point numbers) and 'around'
as in "high around 70" (don't I wish). Any chance of getting these?
While I'm on the subject, I'd be very interested in a
2006 Jan 26
2
Rails Edge stability - has_many :through
Hi all,
If I was to start developing an application using Edge Rails with the
view to deploying on Rails 1.1, would I fall foul of lots of bugs, or is
it relatively stable?
I''d really like has_many :through relationships, to save me dealing with
HABTM + associations.
Thanks,
Tom
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
2006 Aug 17
0
Editiing multiple has_many associations at once
I am search for a nice tidy solution to the following or if only to talk
the problem out aloud.
I have three tables
products
has_many :pricings
pricings
belongs_to :product
belongs_to :pricing_group
pricing_groups
had_many :pricings
I would like to have a single page where I can add/edit a product and on
the same page administer the pricing for that product for each pricing
group.
2006 Jul 24
1
problem with has_many associations
Hi all,
I have some problems with a few temporary objects, this is the relation
between them:
A -(1,n)-> B -(1,1)-> C
B -(1,n)-> D
C -(1,n)-> D
I have a "wizard" to create "A" objects, I''m storing everything in the
session, something like this:
a = A.new
session[:a_object] = a
...
b = B.new
b.c = some_c_instace
a.bs << b
...
d = D.new
b.ds
2006 Apr 04
1
Manipulating has_many :through associations
Hi,
I haven''t done any associations before, so please forgive my incorrect
use of terminology...
If I set up a has_many :through association, can I manipulate the
associated instances directly (like an Array), or do I need to
manipulate the join model?
For example, suppose I have two classes and the associated join model:
class foo
has_many :foo_bars
has_many :bars, :through