Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Coding/Programming Interviews:Active Template Library (ATL)ActiveXApplication DeveloperArtificial intelligenceAssemblyAssociate Software EngineerAWKAWTC ProgrammingC++ ProgrammingCGI PerlCGI ProgrammingCMMICobolCritical ReasoningData Structures TreesDCOM COMDelphiDTDE4XExtensible Stylesheet Language (XSL)FortranFull-Stack DeveloperHaskellHTML DOMILUIPhone DeveloperJasper Reports DeveloperJava DeveloperLisp ProgrammingLotus NotesMicrosoft Foundation Class (MFC)Mobile DeveloperMVC DeveloperNode.jsOOPPascalPerl ProgrammingPHPPHP DeveloperProgrammingProgramming AlgorithmsProgramming ConceptsPythonRubyRuby on RailsRuby on Rails DeveloperSenior Front End DeveloperSenior Software DeveloperSignature ProgramSOASocket ProgrammingSoftware Development EngineerSoftware engineeringSr. PHP ProgrammerStack And QueueSTLSwift DeveloperTCL (Tool Command Language)Team Leader Android DeveloperUMLUnity 2D Games DeveloperUnity 3D DeveloperUnity DeveloperVBA (Visual Basic for Applications)Visual Basic (VB)Visual C++Web DevelopmentWin32APIWindows ProgramingWordPress DevelopmentWSDLXFormsXHTMLXLinkXMLXPathXQueryXSL-FOXSLT
Copyright © 2018. All Rights Reserved
Ruby on Rails Interview Question:
What the difference between static scaffolding and Dynamic scaffolding?
Submitted by: AdministratorWith Rails 2.0, you may have noticed that dynamic
scaffolding breaks-that is, if you have a controller with
scaffold :model_name in it, all the scaffolded actions-new,
delete, index-no longer exist! In Rails 2.0, you can only
generate static scaffolding-that is, you can use the
scaffold to generate the files for controllers, models, and
views.
What's more, Rails 2.0 allows you to specify the model
attributes inside the scaffold. This then creates views with
all the appropriate fields, and it also creates the
migration with all the fields in it! Excellent!
As an example, say we wanted to create a blog-post model. We
could generate it like so:
script/generate scaffold Post title:string content:text
category_id:integer
You'll notice Rails will generate, among other things:
► A post.rb model file
► A posts_controller.rb controller file
► A posts view folder containing views for the index, show, new, and edit actions
► A DB migration called xxx_create_posts
► A unit-test, fixtures file, and helper
Everything you need-indeed, everything the dynamic
scaffolding provided-is included, albeit as static content.
All you need to do is migrate your DB and you're up and flying!
So the main difference is, with dynamic scaffolding you can
generate new, edit and delete methods but with static
scaffolding you can't
Submitted by: Administrator
scaffolding breaks-that is, if you have a controller with
scaffold :model_name in it, all the scaffolded actions-new,
delete, index-no longer exist! In Rails 2.0, you can only
generate static scaffolding-that is, you can use the
scaffold to generate the files for controllers, models, and
views.
What's more, Rails 2.0 allows you to specify the model
attributes inside the scaffold. This then creates views with
all the appropriate fields, and it also creates the
migration with all the fields in it! Excellent!
As an example, say we wanted to create a blog-post model. We
could generate it like so:
script/generate scaffold Post title:string content:text
category_id:integer
You'll notice Rails will generate, among other things:
► A post.rb model file
► A posts_controller.rb controller file
► A posts view folder containing views for the index, show, new, and edit actions
► A DB migration called xxx_create_posts
► A unit-test, fixtures file, and helper
Everything you need-indeed, everything the dynamic
scaffolding provided-is included, albeit as static content.
All you need to do is migrate your DB and you're up and flying!
So the main difference is, with dynamic scaffolding you can
generate new, edit and delete methods but with static
scaffolding you can't
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.