I know this is undoubtably a stupid question, but I beg your patience.
I’m just getting started and I used to program mostly in VB.
I have a company model/table and a quote model/table. When someone
clicks Create New Quote while viewing a Company, I’d like to bring them
to a new quote screen and then “set” the company name field on the new
quote screen to the name from the company screen that they just left.
When you say “assuming, that the routes are set” are you referring to
“belong_to” type statements or do I need to do something with the
config/routes file?
And, in this link “<%= link_to “Quote”, new_quote_path(:company_id => @company.id) %>” what is “new_quote_path”?
When you say “assuming, that the routes are set” are you referring to
“belong_to” type statements or do I need to do something with the
config/routes file?
yes, you must setup the routing, so that rails can find the right
controller and action. something like:
map.resources :companies
map.resources :quotes
And, in this link “<%= link_to “Quote”, new_quote_path(:company_id => @company.id) %>” what is “new_quote_path”?
new_quote_path generates a path/url for you, in this case to the new
action in the quotes controller (and with the additional parameter
company_id)
Welcome to Rails It can take a while to make the switch from
Microsoft to Rails.
I’m finding that. /rueful grin/
Feel free to also use our forums that are setup especially for
Microsoft developers making the switch: forum.softiesonrails.com.
I will definitely check that out.
I’d also highly recommend a book like “Agile Web D. with
Rails” (from pragprog.com, you could just get the pdf if you want) or
“Ruby for Rails” by David A. Black. Both are really good for getting
off the ground with Rails.
I started with Ruby on Rails by Patrick Lenz (which I read cover to
cover) and then added Agile Web… (which I haven’t had time to read
except to look up problems).
I can get things happening if they’re in the same model, but I’m really
stumbling when it comes to referencing things outside the model I’m
currently working in. Perhaps the routing that Thorsten pointed out
will help with that. I’m also struggling with simple things like
building strings, so I added Ruby on Rails for Dummmies to my collection
because it was so easy to find do’s and don’t for simple syntax.
The other thing that’s really tripping me up is drop-down lists. Should
be super easy, but I still don’t have a working one. Every book and
code snippet has a little bit different syntax and none of them seem to
work. Again, I’m trying to reference data in another model, so maybe it
all comes back to that one issue. /shrug/
I know this is undoubtably a stupid question, but I beg your patience.
I’m just getting started and I used to program mostly in VB.
Welcome to Rails It can take a while to make the switch from
Microsoft to Rails.
Feel free to also use our forums that are setup especially for
Microsoft developers making the switch: forum.softiesonrails.com.
I’d also highly recommend a book like “Agile Web D. with
Rails” (from pragprog.com, you could just get the pdf if you want) or
“Ruby for Rails” by David A. Black. Both are really good for getting
off the ground with Rails.
Our blog also tends to focus on Microsoft-to-Rails topics from time to
time.