Hello all, I''ve started to write my first Rails application, using rails 2.3.5 and some tutorials found on the net (for example Four Days on Rails) . I''ve just discovered that the scaffolding information found in most (older) tutorials are completely unusable with recent rails versions . This is my situation : - i have a PostgreSQL database with 3 tables (created manually with my own sql scripts) - i have used ''ruby script/generate model'' , and the generated models seem to be ok - now i want to have the basic controller + views generated for each of the tables I have used ''ruby script/generator scaffold MyModelName'' and it has indeed generated some files. But: the views contain no fields/columns ! Please give me some hint/advice so that i can go on : how can I obtain some complete controller+views for each model (without specifying them manually as arguments) ? -- 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.
2009/12/18 adrian_m <adrian.maier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hello all, > > I''ve started to write my first Rails application, using rails 2.3.5 > and some tutorials found on the net (for example Four Days on > Rails) . I''ve just discovered that the scaffolding information found > in most (older) tutorials are completely unusable with recent rails > versions . > > This is my situation : > - i have a PostgreSQL database with 3 tables (created manually with my > own sql scripts) > - i have used ''ruby script/generate model'' , and the generated models > seem to be ok > - now i want to have the basic controller + views generated for each > of the tables > > I have used ''ruby script/generator scaffold MyModelName'' and it has > indeed generated some files. > But: the views contain no fields/columns ! > > > Please give me some hint/advice so that i can go on : how can I > obtain some complete controller+views for each model (without > specifying them manually as arguments) ?Not answering your question directly but if you have not already done so I would suggest having a look at the rails guides at http://guides.rubyonrails.org/ particularly Getting Started, ActiveRecord Associations, and Debugging.The railscasts are also excellent. Also the free Rails course at http://www.buildingwebapps.com/podcasts is supposed to be good. By the time you have worked through that lot I am sure you will answer your own questions, and probably be back here answering those from others. :) Colin -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi dude, So, to create a model, a controller and layout/views, complety functional, with basic events CRUD(create read update delete) u open a terminal, get inside the folder of your app, and write 1)ruby script/generate scaffold ModelName column1:type column2:type ...columnN:type and hit enter :) 2)rake db:migrate now to get u started, the proper way: 1) u need to have good undestanding of Ruby code, or at least, classes, objects, methods. this type of well grounded info can''t be optained from tutorials, i have been studying computer science for 4 years, but from good bucks.And in my oppinion a good ruby book is Manning.The.Well.Grounded.Rubyist.May.2009. 2) a good rails book, which i don''t have a proper example right now.what i have is Agile Web Development with Rails 3rd Ed, but if u decide to study it, get ready to meet Hell, no joking :) 3) a good reference :raiisguides, from ruby.com, and http://railsapi.com/doc/rails-v2.3.5/ Don''t quite agree with raiscasts, as reference for a noob, not at all. hope this answer made any difference , regards, radup On Dec 18, 3:00 pm, adrian_m <adrian.ma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all, > > I''ve started to write my first Rails application, using rails 2.3.5 > and some tutorials found on the net (for example Four Days on > Rails) . I''ve just discovered that the scaffolding information found > in most (older) tutorials are completely unusable with recent rails > versions . > > This is my situation : > - i have a PostgreSQL database with 3 tables (created manually with my > own sql scripts) > - i have used ''ruby script/generate model'' , and the generated models > seem to be ok > - now i want to have the basic controller + views generated for each > of the tables > > I have used ''ruby script/generator scaffold MyModelName'' and it has > indeed generated some files. > But: the views contain no fields/columns ! > > Please give me some hint/advice so that i can go on : how can I > obtain some complete controller+views for each model (without > specifying them manually as arguments) ?-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Dec 19, 2009 at 13:53, radu puspana <radupuspana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi dude, > > So, to create a model, a controller and layout/views, complety > functional, with basic events CRUD(create read update delete) u open a > terminal, get inside the folder of your app, and write > 1)ruby script/generate scaffold ModelName column1:type > column2:type ...columnN:type and hit enter :) > 2)rake db:migrate >The need to specify all the columns when generating is precisely what I''m hoping to avoid. When I find some spare time I''ll try this : - use the new-style ''generate scaffold'' to create a complete example for a table that is not part of my application - use the ''generate scaffold'' without columns for my real tables - the generated controller doesn''t seem to access the fileds by name, so perhaps the generated controller is not affected by the lack of information about columns - manually add the fields to the views , using code copy-pasted from the complete example If this works I''ll be able to advance with the application.> now to get u started, the proper way: > 1) u need to have good undestanding of Ruby code, or at least, > classes, objects, methods. > this type of well grounded info can''t be optained from tutorials, i > have been studying computer science for 4 years, but from good > bucks.And in my oppinion a good ruby book is > Manning.The.Well.Grounded.Rubyist.May.2009. >I don''t know advanced tricks , but I am familiar with the language.> 2) a good rails book, which i don''t have a proper example right > now.what i have is Agile Web Development with Rails 3rd Ed, but if u > decide to study it, get ready to meet Hell, no joking :) >Is the learning curve really painful with Rails ? I am lacking the time to order books and to properly learn rails : i have the task to build a web application and have the freedom to choose any language+framework. My current intention is to give Rails a try . But if the online documentation resources prove to be not suitable for a beginner (outdated , or disorganized) it would be a shame to be forced to move to some other solution only because it provides a faster startup .> 3) a good reference :raiisguides, from rub y.com <http://ruby.com>, and > http://railsapi.com/doc/rails-v2.3.5/ > Don''t quite agree with raiscasts, as reference for a noob, not at all. >I''m hoping to be able to find some updated good tutorials that are _not_ videos. The internet connection that i have at work is totally unusable for video :D Thanks, Adrian -- 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.