db:migrate runs (single) migrations that have not run yet. db:create creates the database db:drop deletes the database db:schema:load creates tables and columns within the (existing) database following schema.rb db:setup does db:create, db:schema:load, db:seed db:reset does db:drop, db:setup Normally, db:migrate used after having made changes to the schema via new migration files after creating db i.e when db already exists. db:schema:load is used when you setup a new instance of your app.
Today I was stumped by a very simple yet awesome problem by my friend Sandip What is the answer of : 7 % -2 and to the surprise ruby irb printed it as : -1 After some research I what I found about this and why here is explanation and links From Ruby Programming Language, O,really Division, Modulo, and Negative Numbers When one (but not both) of the operands is negative, Ruby performs the integer division and modulo operations differently than languages like C, C++, and Java do (but the same as the languages Python and Tcl). Consider the quotient -7/3. The floating-point result is –2.33. The result of integer division must be an integer, however, so this number must be rounded. Ruby rounds toward negative infinity and returns –3. C and related languages round toward zero instead and return –2. (This is just one way to characterize the results; no floating-point division is actually done, of course.) An important corollary of...
If was trying to migrate one of the app from ruby to jrby to try out the threading benifits. this wasn't an easy task :D well the gem dependency did not create a big issue. the problem came when connecting to mysql with jdbc driver I had replaced gem 'mysql2' with gem 'activerecord-jdbcmysql-adapter' in Gemfile But it refused to load the driver saying : "The driver encountered an unknown error: cannot load Java class com.mysql.jdbc.Driver' I searched but Google could not answer me :( then I started looking into activerecord-jdbsmysl-adapter gem and came upon the the file activerecord-jdbc-adapter / activerecord-jdbcmysql-adapter / lib / active_record / connection_adapters /jdbcmysql_adapter.rb I just copy pasted the code in a application.rb config with a condition if jruby used just after the bundler code if defined?(JRUBY_VERSION) require 'jdbc/mysql' Jdbc::MySQL.load_d...
how to access data stored in session table
ReplyDelete