Tuesday, April 3, 2012

[Rails] Re: RoR and SQL issu

On Apr 3, 10:48 pm, "Miguel A." <li...@ruby-forum.com> wrote:
> I've set up on Windows 7 Eclipse with ruby and radrails and want to use
> MySQL as a database.
> I've executed: gem install mysql2
> And changed the database.yml

what did you change it to? I'd wager you've got adapter: mysql,
whereas it should be adapter mysql2


> Any help? I have searched everywhere and cant get it fix.
> How and where in the gem file do I add what?

Your Gemfile lists all the gems your app uses, if you're using the
mysql2 gem you'd need

gem 'mysql2'

(If you're using an older rails version you may need to specify a
version of mysql2 that is compatible with your rails version.
>
> On another note, if I have 2 tables, one with its primary key being a
> foreign key, does RoR automatically create a <columname_to> on that
> table?
>
Not sure I quite get the question, but rails doesn't create any
columns automatically. Use a migration to add tables or change
existing tables. There are a few shortcuts you can use in the
migration / generators (e.g. rails g model1 model2:belongs_to will add
a column called model2_id as well as an index)

Fred
> Thanks in advance, im stuck :/
>
> Attachments:http://www.ruby-forum.com/attachment/7225/rake.jpg
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate