1 Reply Latest reply on Mar 8, 2013 3:33 PM by Lars Burgess

    RhoMobile Model generation default behaviour with RhoConnect Push

      I am having an issue with the default name of a RhoMobile model generated via RhoStudio 2.2.

      My project uses RhoConnect Push as per webinar "https://developer.motorolasolutions.com/docs/DOC-1721"

       

      Everything work fine as long as the following are observed:

      1. Model name is singular (eg. "Product")

      2. Database table name is plural (eg. "Products")

      3. Database table names must be a single word only (eg. productcode can't use product_code)

       

      However when I become creative and create data base table names using underscore (eg. prop_area) then things go wrong.

      For example if I try and generate a RhoMobile model with the name "prop_area" then the RhoStudio generation process will create a model name "PropArea" and looks for a table name "PropAreas".

      [My workaround is to rename the database table from prop_area to PropAreas and everything works fine].

       

      Also, things get very confusing for me with the RhoConnect Push naming of this object.

      Why because everything is case sensitive and I end up with names like PropArea, Proparea, proparea and propArea (not to mention the plural also eg. PropAreas etc).

       

      Questions:

      Q1. Is there somewhere to control the generator naming conventions used by RhoStudio ?

      Q2. Is there a way to generate RhoConnect Push models, controllers and views as we do with RhoMobile models ?

      [ATM I have to do all this manually using cut and paste from pre-existing code and then renaming etc)]

       

      Thanks - Earl

        • Re: RhoMobile Model generation default behaviour with RhoConnect Push

          Q1. Is there somewhere to control the generator naming conventions used by RhoStudio ?

          RhoStudio uses the rhodes command line tool to generate code, so doing something like "New" -> "RhoMobile model" -> ... is the same as doing:

           

          $ rhodes model prop_area name,brand,price,quantity,sku

          Q2. Is there a way to generate RhoConnect Push models, controllers and views as we do with RhoMobile models ?

          If by "RhoConnect Push models" you mean RhoConnect source adapters then yes, you can use the "source" command:

           

          $ rhoconnect source <something>

           

          for example:

           

          $ rhoconnect source prop_areas

           

          This will generate two files:

           

               [ADDED]  sources/prop_areas.rb

               [ADDED]  spec/sources/prop_areas_spec.rb

           

          RhoConnect Push is just a simple service designed to interact with a RhoConnect application, it doesn't have any models of its own.

           

           

          Everything work fine as long as the following are observed:

          1. Model name is singular (eg. "Product")

          2. Database table name is plural (eg. "Products")

          3. Database table names must be a single word only (eg. productcode can't use product_code)

          I'm not following #1 and #2 here, the model name and database table name are identical.  When I run:

           

          $ rhodes model prop_area name,brand,foo

           

          Then I use FixedSchema with the same properties, indeed I get the same singular, camel-cased table name auto-generated (according to sqlite .schema output):

           

               CREATE TABLE "PropArea" ( "name" varchar default null,"brand" varchar default null,"foo" varchar default null,"object" varchar(255) PRIMARY KEY );

           

          Could you provide details about where you're seeing things auto-pluralizing in the database?  The only thing I see happening is names are camel-cased, not pluralized.