Create a Form With Two Actions on Activeadmin

In a project that already using Activeadmin I had the requeriment of modify the actual form to create a student, but without validating that, so the solution was create into the model of active admin form and declare the form with two actions, one with the clasical behaviour and other when passed the params[:managed] with a custom route ActiveAdmin.register InvestmentItem do # .. form do |f| f.inputs do f.input :student, as: :select, collection: User.students f.input :amount unless params[:managed] f.input :course, as: :select, collection: Course.all f.input :created_at end end if params[:managed] f.action :submit, as: :input, button_html: { formaction: :managed_create } else f.actions # this go to create/update end end # ... controller do def managed_create # do whatewer you want end end end Then button_html: { formaction: :managed_create } options in a :submit, does the trick.

September 11, 2019 · 1 min · Carlos Ramos

“NewRailscasts” My first VScode Theme

I ported my adaption of the ancient railscasts theme for (neo)vim to VSCode, its solarized, supports very well javascript, typescript, ruby and elixir, here’s some screenshots: TypeScript Html + erb Elixir If you like try to install only follow this link or search in Extensions “New Railscasts”, also if you use vim you can install the new-railscasts from my repo.

November 27, 2018 · 1 min · Carlos Ramos

My first elixir library: SoftRepo

don’t destroy sensible data It’s a placer to announce my first library, this handle soft-delete using directly a Repo wrapper, so the main idea is to have a global lib/module that represent all of the logic to do soft-delete of records. The setup and usage has been written on the README of soft_repo. Future The idea is to have a basic library that handles soft-delete, but in a future I’ll implement: ...

October 3, 2018 · 1 min · Carlos Ramos

Lint and Format code with vim and ALE

Currently I’m writing JS and Elixir code and I’ve using a lot of plugins to help me about misspelling in my code, first I was using Syntastic, later I was using Neomake but now I fell in love with ALE and I try to explain why. Ale knows clearly about if a plugin/addon shows an error that plugin/addon can fix that error if is possible. For example if I’m using eslint and I see this error: ...

November 15, 2017 · 2 min · Carlos Ramos

Blockchain, IOT, AI and any ‘hipster’ tech

I have seen a lot of movement in new startups about this new tech trend, in my opinion we need to work on enhance this tech, because is too early in term of implementation, security and real usage. I think the real usage for now is about of speculation money and raise founds by: get a lot of money for my mediocre idea. using startups, ideas, etc “99% of Blockchain Startups Are Bullshit” — @jamie247 https://t.co/vWhSYWozeV #blockchain #machinelearning #ai #startups #vc pic.twitter.com/TFZGXKBYqw ...

September 8, 2017 · 1 min · Carlos Ramos

install passenger 5, ruby 2.x, nginx 1.10.x and enable HTTP/2

Recently I found that passenger in the last version now uses nginx 1.10.x by default, as you knows since nginx 1.9.x nginx enables support for http2 but the 1.9.x on nginx is beta and when released the line 1.10 is production ready. The process will be describe for ubuntu 14.4 and 16.4: Install Dependencies apt-get update -y apt-get upgrade -y apt-get install sudo -y install the required packages: sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake nodejs git-core Install Ruby For production sites is a MUST install from sources without using any versions managers like RVM, RENV or whatever this is why leads to hard to diagnose problems. Remove the old Ruby 1.8 if present: ...

June 24, 2016 · 2 min · Carlos Ramos

My dotfiles

Yes, I finally setup my work environment to work across in my differents machines, I used this tools for that: Tmux Powerline fonts patched (I uploaded my fonts patched) Iterm2 (v3.3) NeoVim Oh-My-Zsh Spf13 vim configuration Check out my public repo in that I wrote how to install if you want reuse my config.

December 21, 2015 · 1 min · Carlos Ramos

Learning Elixir programming language

I’m really exited about to learn new programming language ‘Elixir’ running on top of Erlang OTP, I was reading some books like ‘Metaprograming with elixir’ and other things. The idea of learning is create a websocket for my startup folgama in that I’m planning to ’STREAM’ all of activities about a person, adding geolocalization, upload pictures, send messages. I’m going to share here some of my experience working on that.

November 24, 2015 · 1 min · Carlos Ramos

Restarting to write in this blog

Awesome news! I need improve my english for this i use this blog for practice my writing, if you read some stranger words write happy comments :P, but for photography I’ll write in spanish. happy blogging.

March 13, 2015 · 1 min · Carlos Ramos

great plugin for share session in rails apps between wordpress blog

In one project, the client wants to share same user credentials between rails app to wordpress site, I’ve worked in the same problem 5 years ago creating a plugin for this, so wordpress change many features and I need this feature fast, googling i find this solution: rails login this plugin only need a small API for enable login i created this code in model user: ...

March 13, 2015 · 1 min · Carlos Ramos