Ruby on Rails Friday, March 2, 2012

@Javier: Thanks for your clarifications it's a bit clear to me now

@Colin: I can do that without problem because I'm starting the application so maybe I could create models from scratch using Rails but what about fixtures? I've a table country and will be nice if I can populate the table with 238 records :)
@Walter: Understood but what about relations? How to deal with this from rails command line? I have relations BelongsTo (record belongs to country) and hasMany (record hasMany attachment and some others)

Thanks to every   
Ing. Reynier Perez Mira
eMail: reynierpm@gmail.com, reynierpm@hotmail.com
Skype: reynierpm
Mobile: +58 424.180.5609
Site: http://reynierpm.site90.com


On Fri, Mar 2, 2012 at 11:17 AM, Walter Lee Davis <waltd@wdstudio.com> wrote:

On Mar 2, 2012, at 10:41 AM, reynierpm@gmail.com wrote:

> Also can my tables be named in singular or all needs to be plural? I'm reading conventions right now but have this doubt. For example if I have a table called record the correct name for the model could be Record << ActiveRecord::Base?

You can certainly override the conventions, but it's going to be messy. Particularly if you do something like tell Rails that the plural of record is record. The conventions are there to remove needless configuration.

Walter

> Ing. Reynier Perez Mira
> eMail: reynierpm@gmail.com, reynierpm@hotmail.com
> Skype: reynierpm
> Mobile: +58 424.180.5609
> Site: http://reynierpm.site90.com
>
>
> On Fri, Mar 2, 2012 at 11:09 AM, reynierpm@gmail.com <reynierpm@gmail.com> wrote:
> Thanks Javier and what about ID (PK) fields? Need to be specified too or Rails is smart enough to get them from tables?
>
> Ing. Reynier Perez Mira
> eMail: reynierpm@gmail.com, reynierpm@hotmail.com
> Skype: reynierpm
> Mobile: +58 424.180.5609
> Site: http://reynierpm.site90.com
>
>
> On Fri, Mar 2, 2012 at 11:06 AM, Javier Quarite <jquarites@gmail.com> wrote:
>
>
> On Fri, Mar 2, 2012 at 10:33 AM, reynierpm@gmail.com <reynierpm@gmail.com> wrote:
> Hi:
> I'm starting a simple application to learn Rails and Ruby of course. I come from PHP and frameworks like Symfony, CakePHP and CodeIgniter and some of them have a task to create DB models from existent database which is my case. I have a PostgreSQL database which want to use in my app. My question is: exists any rake or rails command to generate models if they exists in Rails?
>
> Ing. Reynier Perez Mira
> eMail: reynierpm@gmail.com, reynierpm@hotmail.com
> Skype: reynierpm
> Mobile: +58 424.180.5609
> Site: http://reynierpm.site90.com
>
>
> A model can be generated using
>
> rails generate model MODELNAME  field1:type field2:type .....
>
>
>
> Javier Q.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment