#129 ✓resolved
Andreas Ronge

generators should use the Type information

Reported by Andreas Ronge | November 11th, 2010 @ 10:46 PM | in 1.0.0.beta.20

rails generate scaffold User name:String should generate

class User
  property :name, :type => String
end

Comments and changes to this ticket

  • Ben Jackson

    Ben Jackson November 12th, 2010 @ 10:22 AM

    Are you sure you want it that way? I thought since the default is String that the type only makes sense when you need something specifically different, hence the code:

    property :<%= attribute.name %><%= ", :type => #{attribute.type_class}" unless attribute.type_class == "String" %>
    

    Easy enough to remove though if you think it should include type always.

  • Andreas Ronge

    Andreas Ronge November 12th, 2010 @ 03:55 PM

    property :type => String
    

    was a bad example. Default is not String but any primitive type.
    Currently :type is only used for type conversion, so it only make sence if it is a Date, Time or DateTime object.
    Maybe it also make a bit sense if you want to set an expectation for documentation purpose.

    Example

    property :type => Fixnum
    
    would be the same as describe this in a comment
    property :type # :type is a Fixnum
    

    I think there is a point being able to express the type of the property but it should also be possible to generate
    properties without any type information.

  • Andreas Ronge

    Andreas Ronge November 16th, 2010 @ 10:53 AM

    • State changed from “new” to “resolved”

    (from [c0a720ceadb71d6aad4e68d141d3cd8e4c5412e9]) Tidied up scaffold generator [#129 state:resolved]

    Always add type of properties.
    https://github.com/andreasronge/neo4j/commit/c0a720ceadb71d6aad4e68...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket

Referenced by

Pages