Skip to content

Rails generator to create a dynamic scaffold based on the Sammy JS framework.

License

Notifications You must be signed in to change notification settings

groovetrain/sammy_crud

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SammyCrud (Rails generator)

Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby’s Sinatra. github.com/quirkey/sammy

SammyCrud is a Rails generator that creates a dynamic version of the basic scaffold (using Sammy & Ajax). All your CRUD (Create-Read-Update-Delete) operations will happen on the same page. It is for example very useful for quick admin interfaces.

Quick start

  • $ rails sammyonrails

  • $ ./script/plugin install git://github.com/ahe/sammy_crud.git

  • $ ./script/generate model article title:string author:string

  • $ rake db:migrate

  • $ ./script/generate sammy_crud article

Insert the Javascript includes into your layout :

<%= javascript_include_tag 'sammy/jquery-1.3.2.min' %>
<%= javascript_include_tag 'sammy/jquery-ui-1.7.2.custom.min' %>  
<%= javascript_include_tag 'sammy/sammy' %>
<%= javascript_include_tag 'sammy/sammy_crud' %>
  • $ ./script/server

Launch localhost:3000/articles

HAML

If you prefer Haml, this command is for you :

$ ./script/generate sammy_crud article haml

MongoMapper

SammyCrud is now compatible with MongoMapper!

Override default behaviors

If you want to customize one of the action, you can easily rewrite it :

<script type="text/javascript">
  $(function() {
    var app = newSammyApp();

    app.route('get', '#/show/:id', function() { with(this) {
      alert('#/show/:id has been redefined!');
    }});

    addCRUDRoutes(app, 'articles');
    app.run();
  });
</script>

Prefix your URLs

You can simply add a prefix to your URLs like this :

addCRUDRoutes(app, 'articles', 'my_prefix/');

Copyright © 2009 Anthony Heukmes, released under the MIT license.

About

Rails generator to create a dynamic scaffold based on the Sammy JS framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.6%
  • Ruby 1.4%