Git Product home page Git Product logo

5xruby.tw's Introduction

Development Guide

Software Dependencies (OS X)

$ brew install postgres redis imagemagick pkg-config

Setup

$ 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

Tasks

  • 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)

Coding Rules

Generate Admin Pages for Models

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

Schema Updating

  1. Generate migraion file
  2. Update facotry
  3. Update _form.html.erb, show.html.erb and index.html.erb in admin pages.

Assets

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.

Principle of Least Gems

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.

Internationalization for Database Content

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).

Contact

5xruby.tw's People

Contributors

tonytonyjan avatar kaochenlong avatar ryudoawaru avatar carolhsu avatar juanitofatas avatar iamkosuke avatar yushengli avatar treekey999 avatar sabrina823 avatar kendratang avatar withgjr avatar elct9620 avatar beersheep avatar jodeci avatar ninayeh avatar yfxie avatar spartchou avatar ijaykkk avatar koic avatar lctseng avatar zetavg avatar fokayx avatar mylake avatar requiemformemories avatar

Watchers

James Cloos 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.