This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes, this error occurs when I run a rails app on my local: | |
``` | |
ActionView::Template::Error (Webpacker can't find media/images/... | |
1. You want to set webpacker.yml value of compile to true for your environment | |
unless you are using the `webpack -w` or the webpack-dev-server. | |
2. webpack has not yet re-run to reflect updates. | |
3. You have misconfigured Webpacker's config/webpacker.yml file. | |
4. Your webpack configuration is not creating a manifest. | |
Your manifest contains: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS IS WIP, NOT FULLY WORKING | |
class MiniStateMachine | |
# [initial_statuses, event, next_status] | |
@transitions = [ | |
[[:s1, :s2], :event1, :s3], | |
[[:s3], :event2, :s4], | |
[[:s1, :s2], :event3, :s5] | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'csv' | |
def array_hash_to_csv(data, filename = "data.csv") | |
CSV.open(filename, "wb") do |csv| | |
csv << data.first.keys | |
data.each do |hash| | |
csv << hash.values | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VCR.turned_off(:ignore_cassettes => true) do | |
VCR.use_cassette('cassette') do | |
... | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Found in http://stackoverflow.com/questions/10994396/sprockets-rails-find-all-files-sprockets-knows-how-to-compile | |
Rails.application.assets.each_file { |pathname| puts pathname} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user.attributes = { ... } | |
user.save_without_session_maintenance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h = {:a => 1, :b => 2 } | |
h[:c] = row.delete(:a).last | |
>> put h | |
>> {:c => 1, :b => 2 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'factory_girl' | |
FactoryGirl.find_definitions | |
u = Factory.create(:user) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./script/runner 'require("./db/migrate/migration_name.rb").first.constantize.up' |