Sha256: 1158760ea0d6b8447e3b79538babbc0009529f35df7a7217439f42f16b086644

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

<% with_modules(modules) do -%>
class <%= class_name %> < Application
  provides :xml, :fxml

  def index
    @<%= plural_model %> = <%= model_class_name %>.all
    display @<%= plural_model %>
  end

  def show
    @<%= singular_model %> = <%= model_class_name %>.get(<%= params_for_get %>)
    raise NotFound unless @<%= singular_model %>
    display @<%= singular_model %>
  end

  def create
    @<%= singular_model %> = <%= model_class_name %>.new(params[:<%= singular_model %>])
    if @<%= singular_model %>.save
      display @<%= singular_model %>
    else
      display @<%= singular_model %>.errors
    end
  end

  def update
    @<%= singular_model %> = <%= model_class_name %>.get(<%= params_for_get %>)
    raise NotFound unless @<%= singular_model %>
    if @<%= singular_model %>.update_attributes(params[:<%= singular_model %>]) || !@<%= singular_model %>.dirty?
      display @<%= singular_model %>
    else
      display @<%= singular_model %>.errors
    end
  end

  def destroy
    @<%= singular_model %> = <%= model_class_name %>.get(<%= params_for_get %>)
    raise NotFound unless @<%= singular_model %>
    if @<%= singular_model %>.destroy
      display @<%= singular_model %>
    else
      display @<%= singular_model %>.errors
    end
  end

end # <%= class_name %>
<% end -%>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dima-ruboss4ruby-1.0.5 merb_generators/templates/ruboss_resource_controller/controller_dm.rb.erb