SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick RoR Questions

    i have a few quick questions about RoR...

    1. does it support linked selects?

    2. how difficult is it to incorporate javascript slider form elements?

    3. how is form display order determined? i use postgresql and i have difficulty manipulating column order when i have to make change - ie, the last column added is ordered last every time.

    4. does the table id have to be named "id" or can i name it "tablename_id"?

    tia. RoR looks pretty interesting.

  2. #2
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Not sure exactly what you mean, do you mean UNION queries? Can you give an example? ActiveRecord does allow you to call a find_by_sql() method on your model objects so you can always resort to pure SQL for more complex queries.

    2. I haven't really played much with some of the javascript widgets in the scriptaculous library but I believe it has a slider element. Take a look here

    3. Rails has a special helper for generating forms from simple model objects however the majority of the time you will probably want to code your own forms, simply using Rails' built-in helpers to generate individual controls (that are bound to your model). The positioning is entirely up to you as you have full control over the form template.

    4. Rails expects "id" as the default but this can be easily overridden (with one line) and many of the Rails defaults can be overridden in such a way.

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Not sure exactly what you mean, do you mean UNION queries? Can you give an example? ActiveRecord does allow you to call a find_by_sql() method on your model objects so you can always resort to pure SQL for more complex queries.

    actually, i mean where i can fill up an multi-level array (can't think of the standard term right now - an array of arrays) with values and then create a select box with a 2nd linked select. when i choose "California" in the first select, the 2nd select would list all cities in California. If i choose "Washington". the linked select would choose all cities in Washington. The 2nd select is linked to the first select. i have an app where select 3 links to select 2 and select 2 links to select 1. i use Manuel lemos' forms class to get the job done now - and it works nicely.

    2. I haven't really played much with some of the javascript widgets in the scriptaculous library but I believe it has a slider element. Take a look here

    i'll look into it. i have the slider code, i just need to incorporate into the form infrastructure.

    3. Rails has a special helper for generating forms from simple model objects however the majority of the time you will probably want to code your own forms, simply using Rails' built-in helpers to generate individual controls (that are bound to your model). The positioning is entirely up to you as you have full control over the form template.

    i think this answers my question, though i need to research a bit more.

    4. Rails expects "id" as the default but this can be easily overridden (with one line) and many of the Rails defaults can be overridden in such a way.

    i guess i need to read some more.

    thanks for the help.


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
  •