markdown Ruby指南

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Ruby指南相关的知识,希望对你有一定的参考价值。

Adding fields to an object

1. Document it in object model, in the `#structure do` block eg: _models/effective/User.rb_
2. Create a database migration for the fields - run command such as: `rails generate migration add_fields_to_users participant:string how_did_you_hear:string` and it will generate the file for you (migrations appear in _db/migrate/12345_add_fields_to_users.rb_)
3. Run rake db:migrate


http://edgeguides.rubyonrails.org/active_record_migrations.html

Adding a View to Prototype

1. in routes.rb, change the team dashboard to be `only: [:index]`
2. in team dashboard controller, add the index action just like the show action
3. also in team dashboard controller add `skip_authorization_check # CanCanCan ` to the top of the page to bypass user authorization
3. then create /app/views/team_dashboard/index.html.haml
4. then visit /team_dashboard

Add a New Page

1. update routes.rb with the invitations resource, nested in a users namespace (similar to admin). 
2. create /app/controllers/users/invitations_controller.rb 
3. create /app/views/users/invitations/new.html.haml

Adding a Datatable

1. Create datatable in _models/effective/datatables_, eg. _models/effective/datatables/users.rb_
2. Define datatable constant in controller, eg. _controllers/admin/users_controller.rb_ : `@datatable = Effective::Datatables::Users.new`
3. Render the datatable in your view `= render_datatable(@datatable)`


Simple Form

= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
http://guides.rubyonrails.org/routing.html

http://guides.rubyonrails.org/layouts_and_rendering.html

https://github.com/plataformatec/simple_form


You can also view online:

http://espcn-prototype.herokuapp.com
User: espcn
Pass: prototype

http://scip-prototype.herokuapp.com/
User: scip
Pass: prototype

以上是关于markdown Ruby指南的主要内容,如果未能解决你的问题,请参考以下文章

ruby 安装指南

[转]分享 Ruby 用户指南 (简体中文)-初版发布

Markdown 指南

Markdown常用使用技巧--完整入门指南

更好的 ruby​​ markdown 解释器?

markdown [rails:devise] Ruby on Rails的身份验证gem。 #ruby #rails