Trying to get started


#1

I’m having a lot of trouble getting going in InstantRails on Windows in
a new development installation.

I should mention that I’ve installed InstantRails 2.0 on this machine,
and I’m using cygwin over windows for command-line stuff. The
application was previously started elsewhere, which may have used a
different IR installation, I don’t have that information.

So, I get the ruby stuff out of the repository, and change the
database.yml to point to mysql.

At first, I brought up the index of one of my controllers and got a
message which said I had an undefined method ‘paginate’.

Well, I’m not sure where that came from ,bu tsure enough, in index
there’s a call to list, which tries paginate.

So, I tried to regenerate my scaffold. I’m not that far into the
application, no big deal if I lose stuff. I get told that Rails
requires RubyGems >= 0.9.4, and I should do a ‘gem update --system’.

Upon trying that, I get:

c:\ruby\bin\ruby.exe: No such file or directory –
/cygdrive/c/ruby/bin/gem (LoadError).

I don’t understand this, as gem is right there. I resecured it 755 just
in case ruby is kicked off as a different user.

I think I have this installation hopelessly confused, and I don’t really
know where to go from here. Anyone out there have any ideas?

Thank you.


#2

As always, it’s the dumb things. I need to do the updtes from a windows
command prompt, not from the cygwin interface which lays over windows.

Still not running, but getting different ideas of what to install.
Maybe at some point I’ll get it going.


#3

On 2 Dec 2008, at 16:46, Scott P. wrote:

So, I get the ruby stuff out of the repository, and change the
database.yml to point to mysql.

At first, I brought up the index of one of my controllers and got a
message which said I had an undefined method ‘paginate’.

Well, I’m not sure where that came from ,bu tsure enough, in index
there’s a call to list, which tries paginate.

What is now known as classic pagination was removed in between rails
1.2.x and rails 2.0

/cygdrive/c/ruby/bin/gem (LoadError).

I don’t understand this, as gem is right there. I resecured it 755
just
in case ruby is kicked off as a different user.

I think I have this installation hopelessly confused, and I don’t
really
know where to go from here. Anyone out there have any ideas?

Not that I know much about either, but having this parallel cygwin and
instantrails stuff sounds like a recipe for trouble. eg if the ruby
trying to load /cygdrive/c/ruby/bin/gem is a ‘windows’ ruby then it
might not understand what ‘/cygdrive/c/ruby/bin/gem’ means (whereas
the cygwin ruby does)

Fred


#4

Frederick C. wrote:

What is now known as classic pagination was removed in between rails
1.2.x and rails 2.0

Ah, thanks Fred. That explains it. Hopefully I can get my environment
set up to working again, then just start re-generating my application
and take off from there.


#5

Scott P. wrote:

Upon trying that, I get:
Thank you.

It sounds like your app was written using rails 1.2.x. I think you
should try loading InstantRails 1.7 (which has that version of rails)
and make sure you can run the app on that and then you can try to port
the app to rails 2.0 which is on IR 2.x. You can have both versions of
IR installed (but not running) on you system without any problem. Just
install under unique names.


#6

Norm wrote:

Scott P. wrote:

Upon trying that, I get:
Thank you.

It sounds like your app was written using rails 1.2.x. I think you
should try loading InstantRails 1.7 (which has that version of rails)
and make sure you can run the app on that and then you can try to port
the app to rails 2.0 which is on IR 2.x. You can have both versions of
IR installed (but not running) on you system without any problem. Just
install under unique names.

Thanks for the idea, Norm, but I really hadn’t done enough to make it
worthwhile to save, just generated a couple of controllers/models etc
and did some light playing around.

I am really having a heck of a time getting going on 2.0. After
downloading, I can use cookbook and typo just fine. So, I used the
rails command to start my new application’s framework, but I want to
this guy to use mysql instead.

I changed database.yml to point to mysql and gave it my database’s name,
but I can’t get the application to start from the InstantRails
interface. The command window closes after just a second or two, and I
don’t see anything being logged anywhere.

I’ve created the development data in mysql, granted rights on database.*
to myself, but it won’t come up. I even tried configuring the
application with the root username, no dice.

Something simple I’m sure, but I’ve got nothing.


#7

Scott P. wrote:

and make sure you can run the app on that and then you can try to port
downloading, I can use cookbook and typo just fine. So, I used the
application with the root username, no dice.

Something simple I’m sure, but I’ve got nothing.

I like to use the console to explore some of those issues. Bring up a
“ruby console” window in IR and (from the top directory of the app) try
“ruby script/console”. You can then try to access your database and see
what the reaction is. Try something like “a=Tablename.new” to see what
happens when the app tries to get the attributes of the ar class. When
that works you can try things like “b=Tablename.find :all” to fetch all
of the members of a particular ar class. (Both of the Tablenames are an
AR class so they should be singular where the table is plural). If you
can access the tables you know your database connection works so you can
go on to other problems.

Good luck


#8

On Dec 2, 10:10 pm, Scott P. removed_email_address@domain.invalid
wrote:

IR installed (but not running) on you system without any problem. Just

I changed database.yml to point to mysql and gave it my database’s name,
but I can’t get the application to start from the InstantRails
interface. The command window closes after just a second or two, and I
don’t see anything being logged anywhere.

You might find that manually running ruby script/server from a command
prompt gives you a better chance to see the error.

Fred


#9

Scott P. wrote:

BTW, Norm, I tried your idea as well, but the rails console window shuts
down as soon as it starts.

You can get the same thing by bringing up a window running cmd. cd to
wherever IR is and run “use_ruby.cmd” It will set up the paths and cd
to rails_apps. You can then go into your app and do what you want.
There us really nothing special about the “ruby console” window.

Might the problem be that you have not created the database you refer
to? You have to create the database specified in database.rb before you
can do much of anything. Mysqladmin can be used to do that for mysql.


#10

Norm wrote:

Scott P. wrote:

BTW, Norm, I tried your idea as well, but the rails console window shuts
down as soon as it starts.

You can get the same thing by bringing up a window running cmd. cd to
wherever IR is and run “use_ruby.cmd” It will set up the paths and cd
to rails_apps. You can then go into your app and do what you want.
There us really nothing special about the “ruby console” window.

Might the problem be that you have not created the database you refer
to? You have to create the database specified in database.rb before you
can do much of anything. Mysqladmin can be used to do that for mysql.

use_ruby.cmd does show me that the mysql/bin directory is in PATH, so it
seems like I’m o.k. there.

No, the database is there, and I’ve granted rights to my user (who I
assume is the one IR will connect as, since I start it as me).

Something around that though. Hmmm. Thanks for the advice. I’m sure
it’s something simple I’m overlooking.


#11

Frederick C. wrote:

On Dec 2, 10:10?pm, Scott P. removed_email_address@domain.invalid
wrote:

IR installed (but not running) on you system without any problem. ?Just

I changed database.yml to point to mysql and gave it my database’s name,
but I can’t get the application to start from the InstantRails
interface. ?The command window closes after just a second or two, and I
don’t see anything being logged anywhere.

You might find that manually running ruby script/server from a command
prompt gives you a better chance to see the error.

Fred

Hmmm…that seems to start the server, and when I hit port 3000 I get
the default kind of view.

Then clicking on the ‘About your application’s environment’ link gets me
a stack trace which says “no such file to load – mysql”. Points to a
line in custom_require.rb which says:

gem_original_require path

I don’t understand this, mysql is right at the InstantRails directory
level.

Next, I tried putting my application’s database.yml file back the way it
was after generation – using the sqlite3 driver pointing to the
db/.sqlite3 database.

Restarted the server, same message except it can’t load sqlite.

Is it something with the sql stuff not being in the windows path
variable properly maybe? Or maybe I didn’t “install” properly (although
it’s only a zip file, I’m not sure how far wrong I could’ve gone there).

If that’s true, I can’t explain why the cookbook and typo apps seem to
work from IR, as I didn’t do any installation of sqlite3. It’s kind of
like looking through a fog–I think I see pieces of the puzzle, but
don’t see the solution.

Thanks for the responses.

BTW, Norm, I tried your idea as well, but the rails console window shuts
down as soon as it starts.