$ brew install postgres redis imagemagick@6 pkg-config
$ bundle install
$ cp config/application.yml.example config/application.yml
$ cp config/database.yml.example config/database.yml
$ rake db:setup dev:fake
$ rails server
-
rake dev:fake[model_name,count]
dev:fake to generate fake data for all model, dev:fake[course,3] to create 3 fake courses (available parameters: author, post, speaker, category, course, faq)
For example, to generate admin pages for Post
model:
$ rails generate model post title content:text
$ rails generate scaffold admin/post title content:text --migration=false --parent=post
- Generate migraion file
- Update facotry
- Update
_form.html.erb
,show.html.erb
andindex.html.erb
in admin pages.
Assets are managed by gistyle framework (DOM-based routing of Javascript), please follow the convension to keep your code clean. Do not mess them up with view files as much as possible.
Do not easily install gems unless you are familiar with them, generally, functions can be almost accomplished by Rails it self, so think twice before doing.
If you don't like the rules above, you are welcome to challenge @tonytonyjan.
You can define which models and columns to be translated in Translation::AVAILABLE_MODELS
, for example:
# app/models/translations
class Translation < ActiveRecord::Base
AVAILABLE_MODELS = {
Speaker => [:name, :summary],
Video => [:title, :summary, description: :redactor],
}
end
The last element of array can be a Hahs object, keys are column names and values are form field types which correspond to columns, available valies are string
(as text field), text
(as text area) and redactor
(as WYSIWYG editor).