I want to be able to initiially have the ability to have 5 sales, saved
to the database, and after that to make it ajax friendly using partials
etc. I want to do this 1 stage at a time as I am new to rails and want
to try to understand more fully what is going on. So my question is how
do I achieve the 5 sales from a display and controller point of view.
thanks
Martin
I want to be able to initiially have the ability to have 5 sales, saved
to the database, and after that to make it ajax friendly using partials
etc. I want to do this 1 stage at a time as I am new to rails and want
to try to understand more fully what is going on. So my question is how
do I achieve the 5 sales from a display and controller point of view.
thanks
Not sure exactly if this is what you want but it sounds similar and may
be the starting point you need:
Yes thanks I've seen that and could see how it worked where there was a
one to many relationship between project and tasks. I tried implimenting
some of the ideas and failed miserably. It's the initial part I need
most assistance with I think after that I would be able to apply the
knowledge from the screencasts.
thanks
Martin
Yes thanks I've seen that and could see how it worked where there was a
one to many relationship between project and tasks. I tried implimenting
some of the ideas and failed miserably. It's the initial part I need
most assistance with I think after that I would be able to apply the
knowledge from the screencasts.
thanks
Martin
These are the steps:
Create a rails project
Configure your database
Create a controller called sales. Use script/generate controller sales
Create an action in the sales controller called index
Create a model called Sale. Use script/generate model Sale
Fill in the migration (it's in db/migrations folder) to include at least an attribute called name (for our demo)
in the index action, add the following line:
@sales = Sale.find(:all)
now, in your views volder, go into the sales subfolder, and create a file called index.rhtml
in that file, add the following:
<% for sale in @sales %>
<p>
Name: <%= sale.name %>
</p>
<% end %>
this will loop through all the sales, printing out their name.
If you need help with any of those steps let us know.
Now, what model do you want to assocation to sales? Then we can go from there.
Julian.
Learn Ruby on Rails! Check out the FREE VIDS (for a limited time) VIDEO #3 out NOW!
http://sensei.zenunit.com/