Re: [Rails] Model associations and arrays of hashes

2012-03-29 Thread Colin Law
On 27 March 2012 22:10, @jikche wrote: > Hi everyone, I'm new to ruby/rails and trying to build a simple > Projects / Tags app where Projects and Tags are associated as > has_and_belongs_to_many to each other. It's basically a simple list of > projects that have tags associated, and those tags in

[Rails] Model associations and arrays of hashes

2012-03-28 Thread @jikche
Hi everyone, I'm new to ruby/rails and trying to build a simple Projects / Tags app where Projects and Tags are associated as has_and_belongs_to_many to each other. It's basically a simple list of projects that have tags associated, and those tags in turn can be re- used by multiple projects. I've

Re: [Rails] Model Associations

2011-04-06 Thread Colin Law
On 6 April 2011 04:06, Jason wrote: > I'm trying to create a simple POS (Point of Sale) system using rails > 3, ruby 1.8.7 > > I have associations set up in the order models to the items and seats > (tables) > > CODE > > class Order < ActiveRecord::Base >    has_many :order_sp

[Rails] Model Associations

2011-04-06 Thread Jason
I'm trying to create a simple POS (Point of Sale) system using rails 3, ruby 1.8.7 I have associations set up in the order models to the items and seats (tables) CODE class Order < ActiveRecord::Base has_many :order_splits has_many :order_split_items, :through => :ord

Re: [Rails] Model Associations

2010-07-20 Thread Colin Law
On 20 July 2010 20:27, Amit Kumar wrote: > Hi, > > I have just started using rails and i am trying to use IP database to > get user location. > > Here are the database schemas... > > [code]CREATE TABLE IF NOT EXISTS `ip_group_cities` ( >  `ip_start` bigint(20) NOT NULL, >  `location` int(11) NOT N

Re: [Rails] Model Associations

2010-07-20 Thread Frederick Cheung
> > [code] > C = Location.find(1); > [/code] > > It does not show me the columns from the other tables... I mean i dont > see a name column from the Iso3166Countries table. > All you are asking rails to do is load a location object - what were you expecting it to do? Fred > What am i doing

[Rails] Model Associations

2010-07-20 Thread Amit Kumar
Hi, I have just started using rails and i am trying to use IP database to get user location. Here are the database schemas... [code]CREATE TABLE IF NOT EXISTS `ip_group_cities` ( `ip_start` bigint(20) NOT NULL, `location` int(11) NOT NULL, UNIQUE KEY `index_ip_group_cities_on_ip_start` (`i

Re: [Rails] model associations and optimization problem

2010-03-01 Thread Jeremy Kemper
On Mon, Mar 1, 2010 at 11:09 AM, Michal Burak wrote: > Hi. > > Any way to write this more efficiently? Can I make the active record > handle this through some kind of association? > >@images = [] >current_user.foo_models.each do |foo| > @images.concat(foo.images) >end > > class F

[Rails] model associations and optimization problem

2010-03-01 Thread Michal Burak
Hi. Any way to write this more efficiently? Can I make the active record handle this through some kind of association? @images = [] current_user.foo_models.each do |foo| @images.concat(foo.images) end Any help appreciated. -- Posted via http://www.ruby-forum.com/. -- You re

[Rails] Model associations

2008-11-26 Thread Adam
I've got the folowing models associated with each other venture <--- component --> attribute --> service '-->' means 'belongs to' in case someone wonders ;) The thing is i want to show in the 'show' action for the venture components ordered by the service like so @venture.services.each do |ser