I need to wirte a bash script to run commands in my rails console, the commands are : Station.create(......)
#!/bin/bash
rails console
After this line i have no ideas. i tried echo "Station.create(...), but it doesn't help
You want runner.
#/bin/bash
# Maybe need to prefix with `bundle exec`
rails runner 'Station.create(…)'
#!/bin/bash rails runner 'Station.create(cd:"BK",station: "bla", icao: "BKBK", iata:"BKK", synop:"77777", lat:"55.55", lon:"555.55", elev: "5", mflag: "K", nexrad:"K", country_code:"BK", plotting:"5")' exit 0