GithubHelp home page GithubHelp logo

pseudomuto / batman-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from airhorns/batman-rails

0.0 2.0 0.0 352 KB

Easily use batman.js with Rails 3.1

Ruby 93.54% CoffeeScript 3.84% JavaScript 1.49% CSS 1.13%

batman-rails's Introduction

Batman-Rails

Easily setup and use batman.js (0.14.1) with rails 3.1/3.2

Rails 3.1 setup

This gem requires the use of rails 3.1, coffeescript and the new rails asset pipeline provided by sprockets.

This gem vendors the latest version of batman.js for Rails 3.1 and greater. The files will be added to the asset pipeline and available for you to use.

Installation

In your Gemfile, add this line:

gem "batman-rails"

Then run the following commands:

bundle install
rails g batman:install

Layout and namespacing

Running rails g batman:install will create the following directory structure under app/assets/javascripts/:

controllers/
models/
helpers/

It will also create a toplevel app_name.coffee file to setup namespacing and setup initial requires.

Generators

batman-rails provides 3 simple generators to help get you started using batman.js with rails 3.1. The generators will only create client side code (javascript).

Model Generator

rails g batman:model

This generator creates a batman model and collection inside app/assets/javascript/models to be used to talk to the rails backend.

Controllers

rails g batman:controller

This generator creates a batman controller for the given actions provided.

Scaffolding

rails g batman:scaffold

This generator creates a controller, helper and mode to create a simple crud single page app

Example Usage

Created a new rails 3.1 application called blog.

rails new blog

Edit your Gemfile and add

gem 'batman-rails'

Install the gem and generate scaffolding.

bundle install
rails g batman:install
rails g scaffold Post title:string content:string
rake db:migrate
rails g batman:scaffold Post title:string content:string

You now have installed the batman-rails gem, setup a default directory structure for your frontend batman code. Then you generated the usual rails server side crud scaffolding and finally generated batman.js code to provide a simple single page crud app.

batman-rails's People

Contributors

airhorns avatar andriytyurnikov avatar jduff avatar jipiboily avatar potatosalad avatar roywblack avatar sidonath avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.