Good afternoon. I have two questions: First question: Can be defined at the time that I''m generating the scaffold the size of a string? For example name:string (50)? Second question: I wonder how to proceed correctly to include new fields starting at a CRUD generated by scaffold. Example: First step (I use): script/generate scaffold User name:string login:string Second step (I add the field "password: string" in the User CRUD, This field is a password varchar of 50 characters): Problem --->>> I do not do this modification to add a new field. If you have any tutorial to make available, or, please specify step-by-step how to proceed. Best Regards ... Adriano Dias da Silva -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Regarding your first question, You can''t specify the size of the field while you are writing the scaffold command in the command prompt. But, there''s a way you can do that. Scaffolding makes a migration file for you, which actually makes the table for your model. You will find your migration file in /db/migrate folder in your application directory. Open your migration and add *,:limit => number *after your column name. Try it out..It worked for me. regarding your second question, could you be a little more clear about adding on a password field. On Mon, Jul 5, 2010 at 12:56 AM, Adriano Dias da Silva < ti.adrianods-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Good afternoon. > > I have two questions: > > First question: > Can be defined at the time that I''m generating the scaffold the size > of > a string? > For example name:string (50)? > > Second question: > I wonder how to proceed correctly to include new > fields starting at a CRUD generated by scaffold. > > Example: > > First step (I use): > script/generate scaffold User name:string login:string > > Second step (I add the field "password: string" in the User CRUD, > This field is a password varchar of 50 characters): > Problem --->>> I do not do this modification to add a new > field. > > If you have any tutorial to make available, or, please specify > step-by-step how to proceed. > > Best Regards ... > Adriano Dias da Silva > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Regarding the first question, you can put an example?
Currently in my db / migrate is thus:
class CreateUsuarios < ActiveRecord::Migration
def self.up
create_table :usuarios do |t|
t.string :nome
t.string :login
t.timestamps
end
end
def self.down
drop_table :usuarios
end
end
How to get the code?
Referring to my second question I could find out how.
Below is the link to you in Portuguese ...
http://headfirstrails.clanteam.com/blog/category/rails
Best Regards...
Adriano Dias da Silva
____________________________________
On 4 jul, 16:34, Jatin kumar
<jatinkumar.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Regarding your first question,
> You can''t specify the size of the field while you are writing the
scaffold
> command in the command prompt.
> But, there''s a way you can do that.
> Scaffolding makes a migration file for you, which actually makes the table
> for your model. You will find your migration file in /db/migrate folder in
> your application directory. Open your migration and add *,:limit =>
> number *after
> your column name.
> Try it out..It worked for me.
>
> regarding your second question, could you be a little more clear about
> adding on a password field.
>
> On Mon, Jul 5, 2010 at 12:56 AM, Adriano Dias da Silva <
>
> ti.adrian...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Good afternoon.
>
> > I have two questions:
>
> > First question:
> > Can be defined at the time that I''m generating the scaffold
the size
> > of
> > a string?
> > For example name:string (50)?
>
> > Second question:
> > I wonder how to proceed correctly to include new
> > fields starting at a CRUD generated by scaffold.
>
> > Example:
>
> > First step (I use):
> > script/generate scaffold User name:string login:string
>
> > Second step (I add the field "password: string" in the User
CRUD,
> > This field is a password varchar of 50 characters):
> > Problem --->>> I do not do this modification to add a new
> > field.
>
> > If you have any tutorial to make available, or, please specify
> > step-by-step how to proceed.
>
> > Best Regards ...
> > Adriano Dias da Silva
>
> > --
> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To unsubscribe from this group, send email to
> >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> > .
> > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
class CreateUsuarios < ActiveRecord::Migration
def self.up
create_table :usuarios do |t|
t.string :nome
*t.string :login, :limit => 20*
e.g *t.integer :age , :limit => 2 //Here you set the age to be a
short.ie.it now occupies only 2 byte rather than actual 4 bytes of integer*
t.timestamps
end
end
This way you can set limits on the size of your columns. Regarding your
second question, I am still unable to get what you want to do.
On Mon, Jul 5, 2010 at 5:30 AM, Adriano Dias da Silva <
ti.adrianods-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Regarding the first question, you can put an example?
>
> Currently in my db / migrate is thus:
>
> class CreateUsuarios < ActiveRecord::Migration
> def self.up
> create_table :usuarios do |t|
> t.string :nome
> t.string :login
>
> t.timestamps
> end
> end
>
> def self.down
> drop_table :usuarios
> end
> end
>
> How to get the code?
>
> Referring to my second question I could find out how.
> Below is the link to you in Portuguese ...
>
> http://headfirstrails.clanteam.com/blog/category/rails
>
> Best Regards...
> Adriano Dias da Silva
> ____________________________________
>
> On 4 jul, 16:34, Jatin kumar
<jatinkumar.n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Regarding your first question,
> > You can''t specify the size of the field while you are writing
the
> scaffold
> > command in the command prompt.
> > But, there''s a way you can do that.
> > Scaffolding makes a migration file for you, which actually makes the
> table
> > for your model. You will find your migration file in /db/migrate
folder
> in
> > your application directory. Open your migration and add *,:limit =>
> > number *after
> > your column name.
> > Try it out..It worked for me.
> >
> > regarding your second question, could you be a little more clear about
> > adding on a password field.
> >
> > On Mon, Jul 5, 2010 at 12:56 AM, Adriano Dias da Silva <
> >
> > ti.adrian...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > Good afternoon.
> >
> > > I have two questions:
> >
> > > First question:
> > > Can be defined at the time that I''m generating the
scaffold the size
> > > of
> > > a string?
> > > For example name:string (50)?
> >
> > > Second question:
> > > I wonder how to proceed correctly to include new
> > > fields starting at a CRUD generated by scaffold.
> >
> > > Example:
> >
> > > First step (I use):
> > > script/generate scaffold User name:string login:string
> >
> > > Second step (I add the field "password: string" in the
User CRUD,
> > > This field is a password varchar of 50 characters):
> > > Problem --->>> I do not do this modification to add a
new
> > > field.
> >
> > > If you have any tutorial to make available, or, please specify
> > > step-by-step how to proceed.
> >
> > > Best Regards ...
> > > Adriano Dias da Silva
> >
> > > --
> > > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> .
> > > To unsubscribe from this group, send email to
> > >
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>
<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%252Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> >
> > > .
> > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.