Find freelancers. Lose those costly delays.

With 1.7 million freelancers, we'll match you with the perfect talent.

or, Register with Elance »

Rails 3.1 Polymorphic Association Code Example
Sign in to Add to Watch List

IT & Programming > Web Programming

View Change History

The client has made the following changes to the job.


Job canceled.

Dec 4, 2011

Job Description

  |  Change History >>


  • Posted: Sun, Dec 04, 2011
  • Time Left: Closed
  • Location: Anywhere
  • Client prefers freelancers from:

    You are still able to submit a proposal for this job.

    The client prefers freelancers from
    a different location.

    You're still able to submit a proposal for this job, regardless of your location.
  • Start: Immediately
  • Budget: $40 - $50
  • Fixed Price Job
  • Elance Escrow Protection
  • W9 Not Required
Sign in to view client's details

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

Desired Skills
Ruby on Rails
Job ID: 27407491
Avg $ | High $ | Low $ — Show Pricing
  • Submit Date (Latest)
There are no proposals yet.
Elance is now an Upwork company.
Upwork is the choice of 4M+ clients. Get started working on Upwork today.
Are you ready to post a job like this one?
Post a Similar Job »