Sha256: 995f078425c4ab934f5afee1a0b040fcc00028e77f279e6bdc9e0e2fa9e9e72b

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

module Ice
  module GeneratedHelpers
      def self.get_routes
        coffeescript = ""
        Ice::BaseCube.subclasses.map(&:name).each do |cube_model_name|
          model_name = cube_model_name.sub(/Cube/, "")
          name = model_name[0].downcase + model_name[1..-1]

          coffeescript << <<-COFFEESCRIPT

  edit#{model_name}Path = (object)->
    "/#{name.tableize}/" + object.id + "/edit"

  new#{model_name}Path = ()->
    "/#{name.tableize}/new"

  #{name}Path = (object)->
    "/#{name.tableize}/" + object.id

  #{name.pluralize}Path = ()->
    "/#{name.tableize}"

          COFFEESCRIPT
        end
        coffeescript
      end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ice-0.5.1 lib/ice/generated_helpers.rb
ice-0.5.0 lib/ice/generated_helpers.rb