[Rails] routes problem

2011-12-01 Thread Vogon Primo
Hi all, In a sample project, I have a nested resource called ticket, and parent resource called project. rake routes: ... project_tickets GET/projects/:project_id/tickets(.:format) {:action=index, :controller=tickets} POST

[Rails] Re: routes problem

2011-12-01 Thread Vogon Primo
Frederick Cheung wrote in post #1034554: On Dec 1, 11:28am, Vogon Primo li...@ruby-forum.com wrote: POST /projects/:project_id/tickets(.:format) It invokes the show action and not the index action. Why? It's also doing weird stuff because it hasn't picked a project_id from the url

[Rails] Re: Re: routes problem

2011-12-01 Thread Vogon Primo
thiagocifani wrote in post #1034560: in your path are you sending the project object as params? 2011/12/1 Vogon Primo li...@ruby-forum.com root :to= 'projects#index' Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from

[Rails] Re: routes problem

2011-12-01 Thread Vogon Primo
Vogon Primo wrote in post #1034547: Hi all, In a sample project, I have a nested resource called ticket, and parent resource called project. rake routes: ... project_tickets GET/projects/:project_id/tickets(.:format) {:action=index, :controller=tickets

[Rails] legacy MTI schema

2011-11-24 Thread Vogon Primo
Hi all, In a legacy 'immutable' schema I have MTI inheritance setting: TABLE systems idPK ( NOT database generated) installation_date manufacturer serial_number TABLE lifters idPKFK ( NOT database generated ) max_weight drive In my model I have implemented the semantic of inheritance between

[Rails] Re: foreign key referencing nonprimary key

2011-09-19 Thread Vogon Primo
Matt Jones wrote in post #1021972: On Sep 13, 5:27am, Vogon Primo li...@ruby-forum.com wrote: In a legacy schema sometimes we may discover foreign key constraints that don't follow the simple FK references PK rule, but FK references UNIQUE column rule. Is there a way to mapping

[Rails] foreign key referencing nonprimary key

2011-09-13 Thread Vogon Primo
In a legacy schema sometimes we may discover foreign key constraints that don't follow the simple FK references PK rule, but FK references UNIQUE column rule. Is there a way to mapping this with :foreing_key= ... or some other mechanism with ActiveRecord? -- Posted via

[Rails] splitted class into separate table activerecord

2011-09-13 Thread Vogon Primo
Suppose that in legacy schema,that you are working on getting ActiveRecord to work with, you aren't keeping all the information about user, with the user's main information in the users table, but in a separate table. For example: table users user_id firstname lastname table auth_info

[Rails] collections of components

2011-02-22 Thread Vogon Primo
Has ActiveRecord a macro style method for mapping collections of value objects? something like composed_of (used for one value object) but for a collection of value object. A second question: Does ActiveRecord use .eql? to check instances for modifications? Thank you ___Vogon -- Posted via

[Rails] Re: collections of components

2011-02-22 Thread Vogon Primo
Frederick Cheung wrote in post #983171: On Feb 22, 4:23pm, Vogon Primo li...@ruby-forum.com wrote: Has ActiveRecord a macro style method for mapping collections of value objects? something like composed_of (used for one value object) but for a collection of value object. A second question

[Rails] caching database result

2011-02-21 Thread Vogon Primo
Hi guys, Has ActiveRecord 3 a more complex cache mechanism than version released with Ruby on Rails 2.0 ? And has ActiveRecord the concept of scope of object identity? obj1 = MyModel.find(1) obj2 = MyModel.find(1) results in two selects and two different object in memory, why? Where I could

[Rails] ActiveRecord 3 group+select

2011-02-17 Thread Vogon Primo
Hi guys, I'm trying to figure out how to chain together group and select, two finder methods in ActiveRecord 3.x so I have this model class Cow ActiveRecord::Base set_table_name :cows belongs_to :farmer end with breed:string and milk_quantity:integer columns and in client code: result

[Rails] persistence by reachability

2011-01-16 Thread Vogon Primo
Hello guys, I have these models class Farmer ActiveRecord::Base has_many :cows end class Cow ActiveRecord::Base set_table_name :cows belongs_to :farmer end ... graph = Farmer.find(x) # Retrieves four cows of x graph.cows[1].name = Trottolina graph.save while

[Rails] Re: persistence by reachability

2011-01-16 Thread Vogon Primo
Thanks for reply Frederick, What I wrote is really obscure, so let me explain: replacing the name 'graph' with farmer, imagine a situation where in the database there is a record that I retrieve with : farmer = Farmer.find(2) Well, this farmer has many cows associated, and these cows are

[Rails] Re: Re: persistence by reachability

2011-01-16 Thread Vogon Primo
Richard Ramsden wrote in post #975325: Hey Vogon, You should check out the autosave feature in ActiveRecord. I think this is what you're looking for :) http://api.rubyonrails.org/classes/ActiveRecord/AutosaveAssociation.html Cheers, Richard On Sun, Jan 16, 2011 at 11:08 AM, Frederick