top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Importing mysql table in rails

0 votes
32 views

I got ruby and mysql configured successully on my windows pc. Im using mysql as default db. so I created new rails project.

I ran the cmdrake db:create:all
rake db:migrate

so I got the db created. I have existing db of country table. I imported it to the development db.

Question: Is there some files I need to modify so my ror apps will know about my country table? I'm trying to display for instance state is US from the country table.

posted Jul 14, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

+1 vote
 
Best answer

You need to create a model for your table (which should be called countries, rails expects table names to be plural). I suggest working right through a good tutorial such as http://www.railstutorial.org, which is free to use online. That will show you the basics of Rails.

answer Jul 14, 2013 by anonymous
Similar Questions
+2 votes

I have a rails application, in which I am using delayed_job_active_record gem for running background jobs. While using the method .delay with an object, I am getting the following mysql error:

"INCORRECT STRING VALUE: \'XE2X9CX93"X0A ...\' FOR COLUMN \'HANDLER\' AT ROW 1"

I already searched for the above error and found that its because of the difference in encoding in mysql and rails. The solution suggested by many programmers is to alter the encoding in mysql database to utf8. But I also read that MySQL's utf8 charset only partially implements proper UTF-8 encoding. It can only store UTF-8-encoded symbols that consist of one to three bytes; encoded symbols that take up four bytes aren't supported. Which might cause trouble in some other cases. Also, when I tried to insert the value directly in mysql, it worked like a charm. Suggesting that the issue might lie elsewhere. So, can anyone please suggest the right method to rectify this problem?

Any help would be greatly appreciated.

0 votes

I am new Ruby on Rails, I had installed as described below on my machine. Could you please advise good editor compatible to the below configuration? And any additional steps required once i install these?

* MySQL 5.6.27
* Ruby 2.2
* Git
* Rails 4.0
+1 vote

I have just started with rails. I am making a attendance web app. I want to insert student attendance into attendances table and unable to do it as the form just inserts only last entry of the form. Student table and Attendances table have associations (has_many,belongs_to).

Please let me know how the form should be and controller API should look like.

+1 vote

Am trying to send email with yahoo mail but it is not working but, with gmail works fine can someone correct me if anything is wrong in my smtp.

    production:
 :address: smtp.yahoo.mail.com
 :port: 587
 :user_name: test@yahoo.com
 :password: test
 :authentication: plain
 :enable_starttls_auto: true
 :domain : test.com

Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...