rails new <appname> -T --d=postgresql
-T Skips test generator for those prefer using rspec
--d=postgresql generates with Postgresql as database
| // Creates a new axios instance for config | |
| import axios from 'axios' | |
| const instance = axios.create({ | |
| baseURL: 'http://localhost:3000', | |
| timeout: 1000, | |
| }) | |
| export default instance |
| class BaseForm | |
| include ActiveModel::Model | |
| include ActiveModel::Validations | |
| def initialize(params={}) | |
| super(params) | |
| end | |
| end |
| class ProfileForm | |
| # Make ProfileForm acts like a model | |
| include ActiveModel::Model | |
| include ActiveModel::Validations | |
| attr_accessor :user, :profile | |
| # This is shorthand for | |
| # def user_attributes=(attribute) | |
| # user.attributes = attributes |
| class BaseForm | |
| include ActiveModel::Model | |
| include ActiveModel::Validations | |
| def initialize(params={}) | |
| super(params) | |
| end | |
| end |
| class ProfilesController < ApplicationController | |
| def new | |
| @form = ProfileForm.new(current_user) | |
| end | |
| def create | |
| @form = ProfileForm.new(current_user, form_params) | |
| # Now your form can act like a model | |
| if @form.save |
I hereby claim:
To claim this, I am signing this object:
| services: | |
| app: | |
| tty: true | |
| stdin_open: true | |
| build: . | |
| container_name: app_container | |
| ports: | |
| - "3000:3000" | |
| user: "${UID}:${GID}" | |
| volumes: |
| module BoolAt | |
| extend ActiveSupport::Concern | |
| class_methods do | |
| # Defines a bool_at DSL | |
| # allows setting true false on a virtual attribute | |
| # and maps to attr_at | |
| def bool_at(*attrs) | |
| attrs.each do |attr| | |
| at_attribute = "#{attr}_at" |
| services: | |
| app: | |
| build: | |
| context: ./ | |
| dockerfile: Dockerfile.dev | |
| container_name: mapp_container | |
| ports: | |
| - 3000:3000 | |
| volumes: | |
| - ./:/app |