Make a simple blog with inline_forms

inline_forms is a powerfull admin application. it's very easy to extend and use for whatever you want.

Today I will show you how to create a simple blog with this awesome gem.

First off all let's install and create the admin skeleton.
pop open your shell and type this :

> inline_forms create awesome_blog -d sqlite

Take a coffee and hold on thight!
This will install the generator and all nesesary gems.

in this case I will extend inlineforms by adding a tagfield , this will be usefull to tag post

go in the directory awesome_blog and tyoe the following :

> cd `bundle show inline_forms`lib/app/helpers/form_elements

you are now in the inlineforms gem directory.
Make a file named tag
field.rb

And paste the following :


Ready we have a tag field in our app.
IMPORTANT it's not good to make changes in gem directory instead you need to fork the gem and make your changes there, but I will not cover that here anyway.

Next we will make a file in our awesome_blog directory mk_blog.sh, paste the following in your the file.

rails generate uploader Image

rails g inline_forms Picture \  
  name:string \
  caption:string \
  image:image_field \
  description:text \
  admin:belongs_to \
  _presentation:'#{name}'

rails g inline_forms Blog \  
  title:string \
  article:text \
  publish:boolean \
  date:datetime \
  pictures:has_many \
  pictures:associated \
  _enabled:yes \
  _presentation:'#{title}'
  bundle exec rake db:migrate

Now let's get do the database migration thing

> rake db:migrate

next run it be typing this in your shell (awesome_blog directory) :

> sh mk_blog.sh