[Rails] Re: has many through

2012-11-13 Thread Werner
Hallo Erwin. yes I want the data from week with the id 47 and 48 (in this case) Am Dienstag, 13. November 2012 15:23:02 UTC+1 schrieb Erwin: > > with the project_id you get already all the corresponding bookings , right > ? > @bookings = Booking.find_all_by_project_id(params[:id]) > => [#, # 2

[Rails] Re: has many through

2012-11-13 Thread Erwin
with the project_id you get already all the corresponding bookings , right ? @bookings = Booking.find_all_by_project_id(params[:id]) => [#, #] and you want the data associated with the week and the project ? right why don't you join the tables data uisng .join ? Le mardi 13 novembre 2012

[Rails] Re: Has Many Through Controller

2012-03-01 Thread Brandon Might
I actually did mention quantity in my model: "The Orders_Products table has the two id columns (order_id, product_id) and a quantity column". On Thursday, March 1, 2012 12:51:47 PM UTC-5, Max wrote: > > i'm very new to this too so this may be wrong (shameless disclaimer) > > but > > you men

[Rails] Re: Has Many Through Controller

2012-03-01 Thread Max
i'm very new to this too so this may be wrong (shameless disclaimer) but you mentioned quantity in your question but there's no reference to quantity in your description of the models. I would think that you'd also need a quantity field in the Orders_Products model/table to support that and

Re: [Rails] Re: has many through with an extra field

2012-02-15 Thread Peter Vandenabeele
On Wed, Feb 15, 2012 at 11:55 AM, Bodo Kist wrote: > Thanks. > > I forgot to mention that one solution is discussed on > > > http://stackoverflow.com/questions/9174513/rails-has-many-through-form-with-checkboxes-and-extra-field-in-the-join-model/9191867#9191867 > > When I try this approach I got

[Rails] Re: has many through with an extra field

2012-02-15 Thread Bodo Kist
Thanks. I forgot to mention that one solution is discussed on http://stackoverflow.com/questions/9174513/rails-has-many-through-form-with-checkboxes-and-extra-field-in-the-join-model/9191867#9191867 When I try this approach I got an error message from inside the original routine below: Couldn't

[Rails] Re: has many through and STI

2011-01-28 Thread Matt Jones
On Jan 26, 9:50 am, Rodrigo Pavano wrote: > Hello! > > Im using ruby 1.9.2 and Rails 3.0.3. > > I have the following models > > class Property < ActiveRecord::Base > class Feature < ActiveRecord::Base > class DefaultFeature < Feature > class CustomFeature < Feature > class PropertyFeature < Acti

[Rails] Re: has many through and STI

2011-01-28 Thread pepe
Not fully understanding your problem, have you tried named_scope? On Jan 26, 9:50 am, Rodrigo Pavano wrote: > Hello! > > Im using ruby 1.9.2 and Rails 3.0.3. > > I have the following models > > class Property < ActiveRecord::Base > class Feature < ActiveRecord::Base > class DefaultFeature < Featu

[Rails] Re: has many through & associate records

2009-12-31 Thread Piyush with Rails
Hi Jayoshi, But I cannot figure out how to supply all Test id's to create the full set of tests in the Findings table Can you please specify what you need to populate in finding table. as you have mentioned that you need to specify test ids in finding table that is a

[Rails] Re: Has many through

2009-10-24 Thread Marnen Laibow-Koser
Scott Holland wrote: [...]. > > Ok, so now I have the polymorphic relationship set up and working > fine... > > > class Event < ActiveRecord::Base > has_many :guestlists > has_many :notes, :as => :notable > end > > class Guestlist < ActiveRecord::Base > belongs_to :event > has_many :n

[Rails] Re: Has many through

2009-10-24 Thread Scott Holland
> Then your associations, as given in your original posts, do not match > your DB schema. According to your DB schema, you don't need has_many > :through; instead, you need a polymorphic association such that a note > can belong to either a guestlist or an event. Ok, so now I have the polymor

[Rails] Re: Has many through

2009-10-21 Thread Marnen Laibow-Koser
Scott Holland wrote: > >> ...which would be event.notes , since event has_many notes through >> guestlists. > > An event also has notes, so that gives me just the notes for the event. > > In my notes table I have: > > event_id (if the note is about an event) > > guestlist_id (if the note is

[Rails] Re: Has many through

2009-10-20 Thread Scott Holland
> ...which would be event.notes , since event has_many notes through > guestlists. An event also has notes, so that gives me just the notes for the event. In my notes table I have: event_id (if the note is about an event) guestlist_id (if the note is about a guestlist) I need to seperate th

[Rails] Re: Has many through

2009-10-20 Thread Marnen Laibow-Koser
Patrick Doyle wrote: > guestlists is plural. > > event.guestslists returns a list of Guestlist records. > > If you want all of the notes for all of the guestlists for a > particular event, (as an array) you might try something like: > > event.guestlists.collect(&:notes).flatten > > A true Ruby

[Rails] Re: Has many through

2009-10-20 Thread Patrick Doyle
guestlists is plural. event.guestslists returns a list of Guestlist records. If you want all of the notes for all of the guestlists for a particular event, (as an array) you might try something like: event.guestlists.collect(&:notes).flatten A true Rubyista could probably tell you a much more

[Rails] Re: Has many through

2009-10-20 Thread Jose Ernesto Suarez
can you post the table definition? On Oct 20, 11:15 pm, Scott Holland wrote: > Hi there, > > I want to do this, but it's driving me nuts: > > event.guestlists.notes > > i.e. to find all the notes from all the guestlists from a particular > event. > > class Guestlist < ActiveRecord::Base >   belo

[Rails] Re: has many through not working in ruby-enterprise

2009-03-24 Thread mirec
now this is one of the weirdest action which has: logger.info curent_user.user_groups.inspect in itself runs properly --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gro

[Rails] Re: has many through not working in ruby-enterprise

2009-03-24 Thread mirec
now i found in console, that it works in development mode, also running from mongrel is fine >> u=User.find(8) => #> u.user_groups => [# wrote: > forgot to mention > > as i am moving app to new server where i am testing it with REE, i am > getting these errors: > > happens on this line on User mo

[Rails] Re: has many through not working in ruby-enterprise

2009-03-24 Thread mirec
forgot to mention as i am moving app to new server where i am testing it with REE, i am getting these errors: happens on this line on User model: self.user_groups.include?(UserGroup.find(gr)) --~--~-~--~~~---~--~~ You received this message because you are subscr

[Rails] Re: has many :through a named scope

2009-02-20 Thread Luke Redpath
Using :conditions will work but the problem is that you've just introduced duplication between the conditions and the named_scope. Anyway, here's my initial pass at trying to solve this: https://gist.github.com/82c50486bc38b7d7c880 It only works for conditions at the moment which was enough for

[Rails] Re: has many :through a named scope

2009-02-20 Thread Xie Hanjian
Hi Pankaj, I don't know how to do this with named_scope, but maybe you'll like this: class User has_many :pending_friends, :through => :friendship, :source => :friend, :conditions => {'friendships.is_accepted' => 'true'} end However, you can't do sth. like @user.pending_friends << @f

[Rails] Re: has many :through a named scope

2009-02-20 Thread Luke Redpath
I'm also trying to find a way of doing this if anybody has any suggestions; will report back if I find a way of doing it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this gr