[Ror-es] Ayuda con relaciones!!

Ceritium ceritium at gmail.com
Tue Sep 16 21:57:00 GMT 2008


2008/9/16 Juan Moreno <ruby-forum-incoming at andreas-s.net>

> > Por cierto, para mi seria mucho mejor modificar aqui el inflector que
> > ponerle nombres raros a tus clases, aunque personalmente para los
> > nombres de
> > mis clases uso el ingles
>
> Una pregunta amigo Ruben si por ejemplo hago mis clases en ingles
> quedarían de esta forma?
>
>   cities: (id serial NOT NULL,  nomciudad text,  state_id integer)
>   states: (id serial NOT NULL,  nomestado text)
>
> mi modelo quedaron de la siguiente manera:
> (city.rb)
> class City < ActiveRecord::Base
>    belongs_to : state
> end
>
> (state.rb)
> class State < ActiveRecord::Base
>  has_many :city
> end


Sería:

(state.rb)
class State < ActiveRecord::Base
 has_many :cities
end

>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ror-es mailing list
> Ror-es at lists.simplelogica.net
> http://lists.simplelogica.net/mailman/listinfo/ror-es
>



-- 
http://ceritium.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.simplelogica.net/pipermail/ror-es/attachments/20080916/c27ab835/attachment.htm 


More information about the Ror-es mailing list