├── .gitignore ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md └── img └── rails.png /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .vscode 3 | syntaxes 4 | snippets 5 | configuration 6 | package.json -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Rails Snippets Changelog 2 | 3 | # 1.0.6 (2018-04-04) 4 | 5 | * Some error solved 6 | 7 | # 1.0.6 (2017-11-25) 8 | 9 | * New realese with fresh snippets 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Hridoy.net 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rails Snippets 2 | **Now updated for latest rails version** 3 | 4 | This extension for Visual Studio Code adds snippets for Ruby on rails. More 5 | Snippets will be becoming soon. 6 | ## Upcoming: 7 | - Handle Bar Template 8 | - HAML Template 9 | - Custom Error Solution 10 | - Angular Rails 11 | - Reactjs Rails 12 | - Ember Rails 13 | - Jasmin Rails 14 | - Mocha Rails 15 | - Chai Rails 16 | 17 | ![Use Extension](https://github.com/hridoy/media/raw/master/rails-preview.gif) 18 | 19 | See the [CHANGELOG](https://github.com/hridoy/rails-vscode/master/CHANGELOG.md) 20 | for the latest changes 21 | 22 | # Usage 23 | Type the helper name and replace **"_"** with **"-"** 24 | 25 | For Example: 26 | - has-many 27 | - def-create 28 | - def-show 29 | # Controller 30 | 31 | For example: 32 | 33 | | Type | Output | 34 | | ------------- | ------------------- | 35 | | `crud` | full crud helpers | 36 | | `def-create` | def create resource | 37 | | `find-id` | find(id) | 38 | | `find-params` | find(params[:id]) | 39 | 40 | # Model 41 | 42 | ## after 43 | * after-create 44 | * after-save 45 | * after-update 46 | * after-destroy 47 | * after-validation 48 | * after-validation-on-create 49 | * after-validation-on-Update 50 | 51 | ## before 52 | * before-action 53 | * before-create 54 | * before-save 55 | * before-validation 56 | * before-destroy 57 | * before-update 58 | * before-validation-on-create 59 | * before-validation-on-update 60 | 61 | ## has 62 | * has-many 63 | * has-many-through 64 | * has-many-dependent 65 | * has-one 66 | * has-one-through 67 | * has-and-belongs-to-many 68 | 69 | ## before 70 | * validate 71 | * validates 72 | * validates-acceptance-of 73 | * validates-acceptance-of-if 74 | * validates-associated 75 | * validates-associated-if 76 | * validates-confirmation-of 77 | * validates-confirmation-of-if 78 | * validates-exclusion-of 79 | * validates-exclusion-of-if 80 | * validates-format-of 81 | * validates-format-of-if 82 | * validates-inclusion-of 83 | * validates-inclusion-of-if 84 | * validates-length-of 85 | * validates-length-of-if 86 | * validates-length-of-is 87 | * validates-length-of-minimum 88 | * validated-numericality-if 89 | * validated-numericality-of 90 | * validated-presence-of 91 | * validated-presence-of-if 92 | * validated-uniqueness-of 93 | * validated-uniqueness-of-if 94 | ## Migration 95 | 96 | 97 | 98 | | Type | Output | 99 | | ---------------- | ------------- | 100 | | `t.binary` | Binary | 101 | | `t.boolean` | Boolean | 102 | | `t.time` | Time | 103 | | `t.timestamp` | Timestamp | 104 | | `t.timestamps` | Timestamps | 105 | | `t.date` | Date | 106 | | `t.datetime` | Datetime | 107 | | `t.decimal` | Decimal | 108 | | `t.float` | Float | 109 | | `t.integer` | Integer | 110 | | `t.integer-lock` | Integer Lock | 111 | | `t.references` | References | 112 | | `t.rename` | String | 113 | | `t.text` | Text | 114 | | `t.rename` | Rename | 115 | | `t.column` | Column | 116 | | `t.columns` | Columns | 117 | | `add-column` | Add Column | 118 | | `remove-column` | Remove column | 119 | | `change-column` | Change column | 120 | | `rename-column` | Change column | 121 | | `add-index` | Add index | 122 | | `remove-index` | Remove Index | 123 | | `create-table` | Create Table | 124 | | `drop-table` | Drop Table | 125 | 126 | # ERB Template 127 | * for-loop 128 | * each 129 | * if 130 | * if-else 131 | * if-unless-inline 132 | * else 133 | * else-if 134 | * end 135 | * emded (%< %>) 136 | * emded-print (<%= %>) 137 | * collection-select 138 | * stylesheet-link-tag 139 | * submit-tag 140 | * flash 141 | * fixture 142 | * form_tag 143 | * format 144 | * image_submit_tag 145 | * map 146 | * $label 147 | * bye-bug 148 | * buy-bug-erb 149 | 150 | 151 | ## render 152 | * render 153 | * render-action 154 | * render-action-layout 155 | * render-file 156 | * render-file-path 157 | * render-inline 158 | * render-inline-local 159 | * render-inline-type 160 | * render-layout 161 | * render-layout-default 162 | * render-nothing 163 | * render-nothing-status 164 | * render-partial 165 | * render-partial-collection 166 | * render-partial-object 167 | * render-partial-status 168 | * render-text 169 | * render-text-layout 170 | * render-text-layout-true 171 | * render-text-status 172 | * render-update 173 | 174 | # Gem 175 | * gem-development 176 | * gem-test 177 | * gem-production 178 | * gem-development-test 179 | 180 | # Attributes 181 | * presense 182 | * length 183 | * method 184 | * delete 185 | * data 186 | * only 187 | * edit 188 | * update 189 | * show 190 | * destroy 191 | * format 192 | 193 | # Use the Snippets 194 | 195 | Start typing the name of the helper you want (ex: "emb" for "embed") and hit Tab to insert the snippet. 196 | 197 | Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (OSX) to 198 | activate snippets from within the editor. 199 | 200 | ## Installation 201 | 202 | 1. Install Visual Studio Code 1.10.0 or higher 203 | 2. Launch Code 204 | 3. From the command palette `Ctrl`-`Shift`-`P` (Windows, Linux) or 205 | `Cmd`-`Shift`-`P` (OSX) 206 | 4. Select `Install Extension` 207 | 5. Choose the extension 208 | 6. Reload Visual Studio Code 209 | -------------------------------------------------------------------------------- /img/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hridoy/rails-vscode/5eceabfbd9fe8d99ed54283440b0bb148947f5d1/img/rails.png --------------------------------------------------------------------------------