rubyonrailsin

A Ruby and Rails talk

Sunday, March 21, 2010


[Rails] Re: Changing Scafflolds

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

For example if I created a forum with RoR and decided to have a forum,
thread, and post scaffold, and they each has their own properties;
Lets say the forum scaffold was made with these parameters "forum
name:string number:integer". However if I wanted to add another
property to the forum scaffold (for example if I wanted to add
"password:string") how would I do this?

At the moment I have something similar to this (well its different,
but never the less uses scaffolds kind of like this) and I need to add
a new property. Ive tried creating over the top of it with its already
existing parameters plus the ones I want to add (for example "forum
name:string number:integer password:string") however when I do this I
then get this error when I attempt to migrate the database (categories
is the scaffold I'm trying to add properties to):

rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "categories" already exists: CREATE TABLE
"categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name"
varchar(255), "image" varchar(255), "created_at" datetime,
"updated_at" datetime)

(See full trace by running task with --trace)


I really need to be able to:

1)Get past this error.
2)Figure out how to add properties to scaffolds.


Thanks In Advance,

Joe

On Mar 21, 11:53 am, gundestrup <gundest...@gmail.com> wrote:
> Don't you just use the scaffold, as a bases, and the create the rest
> manual?
>
> What is your exact problem:
> What have you done?
> What are you missing/trying to do?
>
> Give concrete examples.
>
> /SG
>
> On Mar 21, 9:06 am, yout...@dev-hq.co.uk wrote:
>
> > Basically I've been creating various RoR (ruby on rails) applications
> > and I cant figure out how to add properties to an already existing
> > scaffold; I have ended up destroying and messing up two projects that
> > I've worked hard on so far in trying to do this and realised I need
> > some help trying to edit these.
>
> > Please Help,
>
> > Joe

--
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

Subscribe feeds via e-mail

Blog Archive