This gem quickly adds a basic ajax functionality to generated scaffold in rails.
Installation
Add this line to your application's Gemfile:
gem 'scajax'
or for the latest version of the gem add:
gem 'scajax', git: 'git@github.com:menuitem/scajax.git'
And then execute bundle:
$ bundle
Also you can install it yourself in your system gems as:
$ gem install scajax
Usage
$ rails g scajax [RESOURCE_NAME]
Quick Simple Example:
-
Add scajax to your application's Gemfile:
gem 'scajax'
-
Run 'bundle' to install this gem in your project:
$ bundle
-
Generate new scaffold called e.g. posts:
$ rails generate scaffold post title body:text published:boolean
-
Don't forget to run migration:
$ rake db:migrate
-
Generate ajax for posts scaffold with scajax generator:
$ rails g scajax post
Open your project in a browser.
Quick Example with twitter-bootstrap:
-
Add to your application's Gemfile:
gem 'scajax' gem 'twitter-bootstrap-rails'
-
Run 'bundle' to install gems in your project:
$ bundle
-
Install twitter-bootstrap:
$ rails generate bootstrap:install static
-
Generate new scaffold called e.g. posts:
$ rails generate scaffold post title body:text published:boolean --no-stylesheets
-
Don't forget to run migration:
$ rake db:migrate
-
Generate boootstrap themed for posts
$ rails g bootstrap:themed posts
-
Generate ajax for posts scaffold with scajax generator
$ rails g scajax post
Open your project in a browser.
(8) If you have somehow file 'scaffolds.css.scss' and you don't use it just delete it:
$ rm app/assets/stylesheets/scaffolds.css.scss
Refresh your browser (F5).
Quick Example with zurb-foundation:
-
Add to your application's Gemfile:
gem 'scajax' gem 'zurb-foundation'
-
And run 'bundle' to install gems in your project:
$ bundle
-
Install zurb-foundation:
$ rails g foundation:install
-
Generate new scaffold called e.g. posts:
$ rails generate scaffold post title body:text published:boolean --no-styelsheets
-
Don't forget to run migration:
$ rake db:migrate
-
Generate ajax for posts scaffold with scajax generator:
$ rails g scajax post
Open your project in a browser.
(7) If you have somehow file 'scaffolds.css.scss' and you don't use it just delete it:
$ rm app/assets/stylesheets/scaffolds.css.scss
Refresh your browser (F5).
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request