With 1.7 million freelancers, we'll match you with the perfect talent.
The client has made the following changes to the job.
Client prefers freelancers from:
You are still able to submit a proposal for this job.
The client prefers freelancers from
a different location.
I'm learning Rails 3.1 and would like a simple, 'least case' working polymorphic code example with forms to help me learn.
Here's my environment that your code example should work under:
Ruby: ruby 1.9.2p290
Rails: Rails 3.1.3
rails generate scaffold Companies name:string
rails generate scaffold Contacts first_name:string last_name:string
rails generate scaffold Notes content:text notable_id:integer notable_type:string
After this you simply setup the polymorphic associations, nested resources etc. to show that both Companies and Contacts can have many notes as 'notable.'
That's it really, there are lots of code examples for Rails 2.x but no working ones I can find for Rails 3.1.
To be working properly - both Companies and Contacts show.html.erb should allow note creation via a form that makes the proper association.
So - to you Rails 3.1 experts - this might be the easiest 'cut and paste' money you ever made - but it will help me a lot :)
Sign in or Register to see more