Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Ruby on rails RestDataSource example

    Since I have not found a complete example for this, I am posting here the code I am using for a rails backend to a RestDataSource.
    This is working for me, but I consider it a first attempt and I will appreciate any help to improve it.
    Comments are welcome!

    Just a note: I am using it in *NON* hosted mode, and the GWT app is served by rails (just put a symlink in rails public folder to the compiled GWT app root).
    The reason is Google Gears does not work in hosted mode under linux.

    UPDATE:
    I have fixed a few bugs and implemented fetch filters.
    Attached Files
    Last edited by marcello.nuccio; 26 Mar 2009, 07:53.

    #2
    Pretty cool Marcello, very short code.

    Right now this only allows filtering on a single specified field, right?

    You might consider contributing this (or a generalized version of it) to the smartgwt-extensions project.

    Comment


      #3
      Also: you should now be able to upload Ruby source files (.rb). 20k max.

      Comment


        #4
        Originally posted by Isomorphic
        Right now this only allows filtering on a single specified field, right?
        Yes. I only use it to filter by foreign key. In the given example, this is needed to fetch the plant_components of a given plant.

        Originally posted by Isomorphic
        You might consider contributing this (or a generalized version of it) to the smartgwt-extensions project.
        Oh, I did not know the smartgwt-extensions project! Thank for the hint.

        I'm not sure how my code does fit into smartgwt-extensions, since it's not an extension to smartgwt. The PlantRDS and PlantComponentsRDS classes are only given as an example implementation of a RestDataSource. The only new code is in isc_controller.rb and it does not belong to smartgwt.

        However, I will clean-up the code a bit and submit it to get some review.

        thanks,
        Marcello

        Comment


          #5
          I have updated the first post with my latest version of the code.
          Now record fields are used during fetch to filter results.
          Text sub-string matching is supported.

          Comment


            #6
            Very nice Marcello. This also works with any Ruby model, right?

            I guess you're correct that it's not technically an extension of SmartGWT, but it is a very useful sample, and perhaps a samples area will be created in the extensions project.

            Comment


              #7
              Yeah, this would be a useful addition to smartgwt-extensions. If you would like to become a committer, please shoot me an email (sanjiv dot jivan at gmail) with your google id.

              Thanks,
              Sanjiv

              Comment

              Working...
              X