Giter VIP home page Giter VIP logo

Comments (5)

flickerfly avatar flickerfly commented on August 31, 2024

Here are some notes on getting it working enough to do the rake ofac:update_data successfully. Hopefully that'll be helpful to someone in the mean time.

sudo gem install ofac
sudo gem install mysql (on ubuntu/debian install libmysqlclient-dev first)
setup a basic rails environment
vim Gemfile and add
gem 'ofac'
gem 'mysql'

generate database...
rails generate model ofac_sdns name:text sdn_type:string program:string title:string vessel_call_sign:string vessel_type:string vessel_tonnage:string gross_registered_tonnage:string vessel_flag:string vessel_owner:string remarks:text address:text city:string country:string address_remarks:string alternate_identity_type:string alternate_identity_name:text alternate_identity_remarks:string

vim db/migrate/sometimestamp_create_ofac_sdns.rb and add this line between the first and second of the three lines containing "end" at the bottom of the file.
add_index :ofac_sdns, :sdn_type

rake db:migrate VERSION=sametimestap

rake ofac:update_data

from ofac.

kevintyll avatar kevintyll commented on August 31, 2024

The gem itself works in rails 3, as we just recently upgraded ourselves and we're still using the gem just fine. Unfortunately, it looks like the generator probably does not work. You are getting the "could not find..." error because rails 3 looks for generators in lib/generators. My generators dir is not in the lib dir.

However, I suspect the problems are more than just the location of the files. Generators got a big overhaul in rails 3 using thor now. I believe even the generator base class namespace has changed.

If you wanted to try your hand at upgrading it, that would be super, I be very appreciative. But if you just want to run the migration and be done, then it's simple enough to do it manually. Just create a migration and copy the contents of generators/ofac_migration/templates/migration.rb into it.

Good luck. I hope you find the gem useful.

Kevin Tyll
[email protected]

On Dec 22, 2011, at 10:03 AM, Josiah Ritchie wrote:

Forgive me for my newbness.

I'm trying to use your OFAC gem (v 1.2.3) in rails 3. The README tells me to do scripts/generate ofac_migration which I've determined changed in rails 3 to something like rails generate ofac_migration. When I tried that rails reported "Could not find generator ofac_migration."

Is it possible to use this gem in rails 3? If you can toss me some quick commands I'll be glad to format that into a pull request for inclusion in the readme.

Thank you!


Reply to this email directly or view it on GitHub:
#2

from ofac.

flickerfly avatar flickerfly commented on August 31, 2024

Great, I'll poke at it and see if I can't add something to the project.

from ofac.

hayd avatar hayd commented on August 31, 2024

I saw the following error

File conversion ran for 0.0226355272 minutes.
Deleting all records in ofac_sdn...
Importing into Mysql...
rake aborted!
ActiveRecord::StatementInvalid: Mysql::Error: The used command is not allowed with this MySQL version:     LOAD DATA LOCAL INFILE '/tmp/ofac20140417-3814-1xikzyz' REPLACE INTO TABLE ofac_sdns FIELDS TERMINATED BY '|' ENCLOSED BY "`" LINES TERMINATED BY '

I couldn't seem to get this workaround working, but atm it looks like you need to reconfigure (recent versions of) mysql before this is allowed. http://stackoverflow.com/questions/18437689/error-1148-the-used-command-is-not-allowed-with-this-mysql-version ?

from ofac.

kevintyll avatar kevintyll commented on August 31, 2024

I was never aware of that server variable. Looking at the mysql manual, it looks like the default is still to have it enabled up to version 5.7. I'm not sure rails can set the variable when establishing a connection. It may not work unless it's enabled on the DB itself.

A down and dirty solution would be to rescue that error in the bulk_mysql_update method and call active_record_file_load. Feel free to submit a pull request if you find a solution.

from ofac.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.