RoR for dummies .. from nothing to knowlege

Well,
i’m like a dinosaur … an ASP classic procedural developer but I think
it’s’ time to evolve, so I started learning RoR and OO/MVC programming.

As a First step I did the two “try” on the netbeans website and
everythig was fine so i’m making a to do list of simple project for
getting better and better
knowlege about Ror.

righrt now i thinked this “demo” project:

1:
a CRUD for making mail footer (you can insert your name , phone ,and
skype)
and the app will make a nice .zip with inside a personalized html to use
as mail footer. (right now I have this app made with asp+mdb

2:
a login system … a user can register himself with mail validation and
later logon and change his password

3:
a filemanager … you can upload , download and delete a file

next … ?

add your comment

thanks

You can find all the needed code snippets in Advanced Rails Recipes. I
would recommend using this book for pointers and code snippets.

http://railsbookclub.com/advanced-rails-recipes

(zipping up and generating files, login system through
acts_as_authenticated, manipulating files)

Simone R. wrote:

Well,
i’m like a dinosaur … an ASP classic procedural developer but I think
it’s’ time to evolve, so I started learning RoR and OO/MVC programming.

As a First step I did the two “try” on the netbeans website and
everythig was fine so i’m making a to do list of simple project for
getting better and better
knowlege about Ror.

righrt now i thinked this “demo” project:

1:
a CRUD for making mail footer (you can insert your name , phone ,and
skype)
and the app will make a nice .zip with inside a personalized html to use
as mail footer. (right now I have this app made with asp+mdb

2:
a login system … a user can register himself with mail validation and
later logon and change his password

3:
a filemanager … you can upload , download and delete a file

next … ?

add your comment

thanks

Vincent B. wrote:

You can find all the needed code snippets in Advanced Rails Recipes. I
would recommend using this book for pointers and code snippets.

http://railsbookclub.com/advanced-rails-recipes

(zipping up and generating files, login system through
acts_as_authenticated, manipulating files)

well, more than find the actual code I need some hint if this demo apps
can
be useful for learning the “building blocks” , for sure I will buy the
book for reference but in the ASP world with this 3 app you can build a
good starting knowlege , maybe in RoR is differen there are other
problem on wich you need to build skill before going on real programming

well, more than find the actual code I need some hint if this demo apps
can
be useful for learning the “building blocks” , for sure I will buy the
book for reference but in the ASP world with this 3 app you can build a
good starting knowlege , maybe in RoR is differen there are other
problem on wich you need to build skill before going on real programming

You might take a look at the RailsSpace book. It goes through the
creation
of a social network site using rails and assumes zero knowledge.

http://www.amazon.com/RailsSpace-Building-Networking-Addison-Wesley-Professional/dp/0321480791/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1236105978&sr=8-1


Starr H.
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/

Simone R. wrote:

Vincent B. wrote:

You can find all the needed code snippets in Advanced Rails Recipes. I
would recommend using this book for pointers and code snippets.

http://railsbookclub.com/advanced-rails-recipes

(zipping up and generating files, login system through
acts_as_authenticated, manipulating files)

well, more than find the actual code I need some hint if this demo apps
can
be useful for learning the “building blocks” , for sure I will buy the
book for reference but in the ASP world with this 3 app you can build a
good starting knowlege , maybe in RoR is differen there are other
problem on wich you need to build skill before going on real programming

RailsSpace, Beginning Rails or Simply Rails 2 are great learning books.
These books take you through the process of developing an entire app
from a to z. (social network, e-commerce site of news site)

I find these methods really handy. Not only do you get a cleared picture
of the coherence of the code, you also learn a bit about plugins,
generators, test driven development, ajax etc.

I would start with: Beginning Rails (http://tinyurl.com/b438x8). A file
manager and a mail footer creator are not the best starting points,
since an important part of Ruby on Rails is developing database driven
webapps and working through the MVC principle.

i think your project is a pretty good start. if you are going to code
it all by yourself, maybe even put your authentication-code into a
plugin and in the end try to exchange it with sth. like
restful_athentication, then you got your hands dirty enough to start a
serious project. depending on your personal goals you could take a few
steps into the way rails handles AJAX (prototype, …).

in general your goals should be to:

  • be able to write some basic ruby-code
  • get an understanding for the way rails works and models, views and
    controllers interact with each other
  • work with plugins (use them and maybe write your own) and gems
  • write valid html and css
  • use some AJAX
  • secure your application

as i see it your demo-project allows you to dive into all these
topics. everything else depends on your personal needs and plans.

oh, yeah i forgot:

  • be sure to test your app. either you use the built in test-
    framework or something like rspec.

btw: it really doesn’t matter which book your reading or which
tutorial you are following. your approach of getting your hands dirty
and trying to build a (not so trivial) app on your own is IMHO a very
good one. you will need to combine the examples of different tutorials/
books into one working app. that will teach you a lot about rails.

Simone,

lots of people don’t know about Rails Guides project:

. It has wonderful up-to-date content on lots of topics.

You may want to start with “Getting Started with Rails”:

–karmi

On Mar 3, 11:14 am, “Simone R.” [email protected]

Well,

first many thanks to all of you for all you hints, they are very
usefull.

for now I did a few times both this tutorial
http://www.netbeans.org/kb/docs/ruby/rapid-ruby-weblog.html
http://www.netbeans.org/kb/docs/ruby/model.html

and i feel a little less dinosaur :slight_smile:

after this tutorial I created another application with two model (cars
and animals) an I made links from one model to the other in different
point
(just for fun and for unterstanding rest) …

now I’m trying to make an “”“homepage”" with a list of all models
existing in my app.

Reading around looks like I need an “observer” … but I’m not sure (as
usual)

How can i get a page that dinamically generate something like
ul
li \cars
li \animals
ul

How can i get a page that dinamically generate something like
ul
li \cars
li \animals
ul

i forgot … my apps is made out of

generate scaffold car name:string power:string
generate scaffold animal name:string speed:string

controller:

def show_all_models

require all of your models so they get loaded

Dir.glob(RAILS_ROOT + ‘/app/models/*.rb’).each { |file| require
file }

find all subclasses of ActiveRecord

@all_models = Object.subclasses_of(ActiveRecord::Base)
end

view:

    <% @all_models.each do |model| %>
  • <%= model %>
  • <% end %>

if you are using ActiveRecordStore there is probably a model in there
for that as well. if you don’t want to display that one, remove it
inside your controller.

MaD wrote:

controller:

def show_all_models

require all of your models so they get loaded

Dir.glob(RAILS_ROOT + ‘/app/models/*.rb’).each { |file| require
file }

find all subclasses of ActiveRecord

@all_models = Object.subclasses_of(ActiveRecord::Base)
end

view:

    <% @all_models.each do |model| %>
  • <%= model %>
  • <% end %>

if you are using ActiveRecordStore there is probably a model in there
for that as well. if you don’t want to display that one, remove it
inside your controller.

OK , it works … but I have to put it inside the animals controller and
inside
the def index , how can I create an “homepage” ?

NEXT STEP

In my app there is a class CAR name:string power:string (has_many:
WHEELS)
… is possible to create a scaffold of MUSCLE_CAR that extend CAR and
inherit everything from CAR (name,power and WHEELS)

and later if I add something to CAR (like door_number) will also appear
into MUSCLE_CAR ?