scaffolding and updating attributes manually in ruby on rails howto? -


If I knew how to update any files (linking / removing / updating a feature) Doing the Rubber on Rails produced by using scaffold generators

For example:.

Scandal Student's Name: String Lastname: String

Then it will create a collaborative files (controller, view, etc.) with name and last name as string attribute . When you migrate the project to DB: it will create a table in the database. However, I have to update whether it wants to be updated with an additional attribue (pre studenId: integer) or by removing it or updating a feature, you can add that

< P> How do I update just tired? Generated files, but when I do that to DB: Migrating it still sets the schema on the table, which is generated. Is there a script in the train in which the table will be updated?

Any advice appreciated? From the console, you need a new migration file to the new features:

 

$ script / gnerate stay add_sudentid_to_sudent

it your_app / db / migrate / 8293898391_add_sudentid_to_sudent.rb will generate, spicify the new properties file: < / P>

  def self.up add_column: studentId,: integer end DEF self.down removal_column: students, studentsId  

after that, back console For:

$ rake db: migrate


Comments