SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rails need help getting model for some_id row

    hey there, i have a problem that i have been wrestling with for a few days now.

    i have a table called machines
    machine has_many : options
    the options model looks like this:
    `id`, `machine_id`, `description`, `sensor`

    now `sensor` is the `id` of a sensor in one of many different tables
    like `pressure_sensors` or `volt_sensors`
    and `pressure_sensors` has `sensor_id` that will match up with `sensor` in the options model

    my question is, how to i get the sensor_id for a `pressure_sensor` where option.description = 'pressure'

    so i need my machine to have a `pressure_sensor` based on whether or not one of the machine.options.description == 'pressure'

    does this make sense?

    thanks

  2. #2
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    never mind, got it to work


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •