Questions tagged [mysql2]

The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results.

The mysql2 gem is an interface for accessing MySQL databases from Ruby. This gem is an incompatible improvement over the original mysql gem.

Links:

907 questions
0
votes
2 answers

the rails server isn't getting started

it show some errors like C:\Users\Vishnu\Sites\simple_cms>rails s E:/installations/Ruby/lib/ruby/gems/2.0.0/gems/mysql2-0.3.16/lib/mysql2.rb:8:in `require': 126: The specified module could not be found. -…
Harish Gopalakrishnan
  • 1,504
  • 2
  • 11
  • 11
0
votes
2 answers

Cannot install mysql2 in Ruby 2.0

I'm having problems installing mysql2. I've successfully installed it before. I have the latest Ruby version 2.0 and managed to install mysql2. Yesterday, I downgraded to Ruby 1.8.7 to run some old projects and test it. Then I uninstalled all ruby…
jackhammer013
  • 2,295
  • 11
  • 45
  • 95
0
votes
0 answers

Rails generated query error

I have a scope in my Rule model using a HABTM relationship joining the Room and Rule models. # rule.rb scope :in_room, -> (room) { where(rooms: room) } has_and_belongs_to_many :rooms # schema.rb create_table "rooms_rules", id: false, force: true do…
Johan Lindskogen
  • 1,246
  • 1
  • 8
  • 25
0
votes
1 answer

Best Way to Start database from particular number(id) + rails

Rails app + mysql db. I want to start the db on production from a particular id, what is the best way to do it. The first that is coming to my mind is seeding. Is there any better way I am missing here?
Deepender Singla
  • 999
  • 9
  • 28
0
votes
1 answer

Rails ActiveRecord query on existing collection

Suppose I have a result from a query: allCourses = Course.all Then I also have another set: myCourses = current_user.courses.all How can I get a set of items that are in allCourses and NOT in myCourses? Here are the models: class Student <…
Khanetor
  • 11,595
  • 8
  • 40
  • 76
0
votes
1 answer

Connecting Remote mysql2 from rails app on ubuntu platform

i am using two ubuntu machines, one for mysql2 server and another one is for rails with mysql2 client, i am in need of connecting mysql2 server from rails app which is in another machine. i used the configuration in database.yml : default:…
Daniel Raj
  • 53
  • 1
  • 8
0
votes
2 answers

Is it possible to have a DB uniqueness constraint across columns of two tables?

I have a mysql DB with rails, and a column "shorthand" (string) that I'd like to make unique across multiple tables. Is there a way I can do this without making a third table? Expression id shorthand ... etc Variable id shorthand ... etc I want…
charlie
  • 181
  • 13
0
votes
1 answer

Can't show values from my view using mysql2 gem

I did a query in MySql but is not working Rails so I installed mysql2 gem. Here is the information: http://sqlfiddle.com/#!2/9adb8/6 The query is working fine without problems and showing this result: UNIT V1 A1 N1 V2 A2 N2 V3 A3 N3 V4…
Carlos Morales
  • 1,137
  • 3
  • 15
  • 38
0
votes
1 answer

Turn Ruby Mysql query into variable

I'm currently trying to figure out how to get the username as a ruby variable however I end up getting the following {"username"=>"test"} I only want the username text in this case it is test. client = Mysql2::Client.new(:host => "localhost",…
David_Hogan
  • 125
  • 1
  • 3
  • 14
0
votes
2 answers

How to configure mysql2 database in heroku

I am using mysql database in my rails application, my development database is mysql2. I want to set mysql2 database in heroku. how to configure mysql2 database in heroku?
Sowmya M R
  • 93
  • 1
  • 8
0
votes
2 answers

Error installing mysql2 gem on windows 7

I am using below command to install mysql2 gem: gem install mysql2 -- '--with-mysql-include="C:\Program Files\MySQL\MySQL Server 5.6\include" --with-mysql-lib="C:\Program Files\MySQL\MySQL Server 5.6\lib"' but getting below error C:\Ruby200\bin>gem…
yudi2312
  • 323
  • 1
  • 4
  • 21
0
votes
1 answer

Weechat Ruby Plugin - Trying to require any gem results in an error

I'm trying to create a plugin that uses mysql2 which will allow communication to a database from IRC. The problem I am facing is that I can not require any gems into the plugin without it crashing. require 'mysql2' @client = nil def weechat_init …
Singularity
  • 271
  • 2
  • 11
0
votes
3 answers

Large Inserts with mysql2 Gem

I usually write my inserts like this: query = " INSERT INTO SomeTable (Column1, Column2) VALUES #{data.map { |row| "(#{row[0]},#{row[1]})" }.join(?,)} " But I shudder to think about the massive strings that are being created when my…
Max
  • 21,123
  • 5
  • 49
  • 71
0
votes
1 answer

Confirmation token can't be blank

Earlier i was getting - token not found .After making changes advised here i am getting this new error Confirmation token can't be blank. Using rails - 3.0.6 devise - 1.1.3 ruby - 1.9.3 Been banging my head since hours and i am still clueless why…
Caffeine Coder
  • 1,869
  • 1
  • 17
  • 35
0
votes
1 answer

connection refused error in ruby while connecting to mysql database

When I am trying to connect to Mysql database using ruby then I get "Connection to Data Source [2] failed: java.net.ConnectException: Connection refused" error. I am using RubyMine IDE and I have downloaded Mysql server and workbench and installed…