Re: [Rails] Active Record question

2015-07-13 Thread Colin Law
On 13 July 2015 at 19:20, tamouse pontiki wrote: > A quick correction on Colin's suggestion: > > On Mon, Jul 13, 2015 at 2:44 AM, Colin Law wrote: >> >> On 13 July 2015 at 01:10, j...@via.net wrote: >> > class Asset < ActiveRecord::Base >> > belongs_to :site >> > >> > # class variable :name

Re: [Rails] Active Record question

2015-07-13 Thread tamouse pontiki
A quick correction on Colin's suggestion: On Mon, Jul 13, 2015 at 2:44 AM, Colin Law wrote: > On 13 July 2015 at 01:10, j...@via.net wrote: > > class Asset < ActiveRecord::Base > > belongs_to :site > > > > # class variable :name > > > > end > > > > class Site < ActiveRecord::Base > > has_

Re: [Rails] Active Record question

2015-07-13 Thread Colin Law
On 13 July 2015 at 01:10, j...@via.net wrote: > class Asset < ActiveRecord::Base > belongs_to :site > > # class variable :name > > end > > class Site < ActiveRecord::Base > has_many :assets > > # class var x, y, z > > end > > Is there a dynamic finder that will traverse the inner join: > >

Re: [Rails] Active Record question

2015-07-12 Thread Vineeth B S
Ransack https://github.com/activerecord-hackery/ransack Seems like a promising for your usecase. Take a look at it. On Mon, Jul 13, 2015 at 5:40 AM, j...@via.net wrote: > class Asset < ActiveRecord::Base > belongs_to :site > > # class variable :name > > end > > class Site < ActiveRecord::B

[Rails] Active Record question

2015-07-12 Thread j...@via.net
class Asset < ActiveRecord::Base belongs_to :site # class variable :name end class Site < ActiveRecord::Base has_many :assets # class var x, y, z end Is there a dynamic finder that will traverse the inner join: e.g. Site.find_by_asset_name("xyzzy") Can I get a list of sites where as

[Rails] Active Record Question

2011-08-27 Thread John Doe
Hi...I am only 1 day into Rails, so please forgive me if this is a lame question! I have the following models: require 'books_projects.rb' class Project < ActiveRecord::Base has_many :book_to_projects has_many :books, :through => :book_to_projects end require 'books_projects.rb' class Book

[Rails] active record question

2010-07-01 Thread badnaam
I have three models, Question, Response and User User has many question, :through Responses My response table has 3 main columns response, question_id and user_id. The use case is lets say the user can respond to 100 question, but during a session he responds to 20. How do I find out the ones he

[Rails] Active record question

2008-09-06 Thread Mark Studebaker
I'm not quite sure how to get at this data using Actrive record.. I'm trying to get all the appointments made for a particular project. I'm using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I'm looking for but how do I do it using Active Record? Select a.* f