Error from terminal:
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log': NoMethodError: undefined method `execute' for 35386727:Fixnum: SELECT min(date_stamp) AS min_date_stamp FROM comics WHERE (comic_name = 'garfield') (ActiveRecord::StatementInvalid)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:137:in `execute'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:329:in `catch_schema_changes'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:137:in `execute'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:157:in `select_all'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/sqlite_adapter.rb:169:in `select_one'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/database_statements.rb:16:in `select_value'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:164:in `execute_simple_calculation'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:144:in `calculate'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/calculations.rb:81:in `minimum'
My class code:
class Comic < ActiveRecord::Base
def self.first_date_stamp(comic_name)
Comic.minimum :date_stamp, :conditions => ['comic_name = ?', comic_name]
end
def self.last_date_stamp(comic_name)
Comic.maximum :date_stamp, :conditions => ['comic_name = ?', comic_name]
end
end
I use only ActiveRecord (latest version) in my project… database is SQLite 3 (ruby adapter v2.7)… my script generates a lot of creates… is it maybe because it is too fast for ActiveRecord and/or SQLite3?
I can’t find anything about it… I even don’t understand it… the script works perfectly for about 20 seconds and then it goes wrong. But by then it has already done a lot of creates.
Strange isn’t? ;) So… please help me (or solve the bug in Rails/AR) Thanks in advance.
I catched the exception in my code and ignored it (I do only some ouput so that I know that it happens and how often). Now my script works… (it still goes wrong but) there’s nothing wrong with the expected output.
If you get blank screens and no log entries, try to remove all ruby session files in:
$ rake tmp:sessions:clear
After this, things should work fine in most cases. This problem has been reported to happen with Webrick and Lighttpd both.
If it doesn’t work check if you have IRB module installed (expecially if you work on Debian, Ubuntu…) Also, check that the Web server has write permissions on the tmp/ directory inside your application, and on all of its subdirectories.
If you’ve set ActiveRecord to use database storage instead of the default file based storage, make sure you run “rake db:sessions:create”. This is especially true if you have multiple development machines. If you set up the session table on one machine, then update your code based on another, you get a blank page if you haven’t created the session table on the other machine.
Question:
Hi guys.
I am trying to get Ruby on Rails working but having some real challenges. I use Win XP, mysal 5.0 and Rails 1.0.
Every time I run the “generate /scaffold…�? I get the “error updating scaffold from DB..�?
I have tried every fix I can find on the internet but none work for me. In fact it seems many people know there’s an speed bump with that command but they can just roll over it.
As I really need to get an answer ASAP and I’m tired of getting racked. I would like to offer a small reward to the person who can give me an answer to this (and any subsequent problems they know to exist). Please post answer here and send to prosys at hot mail, subject line “RAILS�? and I will get in touch. I need a definite answer not "hope this helps’, I’ve seen enough of that.(You just have to trust that I’m honest)
Thanks.
Thanks for nothing all you buggers! – After -days of searching. My pain has been releaved by an anonymous helper at…. the onlamp site who writes:
1"yaml files can be sensitive to format, so make sure your “password:” line starts with two spaces and has a single space after the colon, followed by the password itself. Make sure you don’t have any extraneous unprintable characters (a hex editor helps here).
2Also, it should use the “development:” section by default, but just to be sure you should also set the test and production sections.
3Finally, make sure you can access your MySql database with that username/password using some other software (like MySql-Front) to verify that you can, in fact, access your database"
The key for me was formatting issue in the YML file.
If you find edits to .rhtml templates don’t ‘take’ in development, double check your system clock. If your files are saved on a network drive, and your system clock is off, your files may never recompile because the last-modified time never passes the last-compiled time of the template.
If I start a new Rails 1.1.4 project ( rails test_it ) cd into the folder and then try to start the server ( ruby script/server ) I get:
<pre>
% ruby script/server
=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> config/lighttpd.conf not found, copying from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/configs/lighttpd.conf
=> Rails application started on <a href="http://0.0.0.0">http://0.0.0.0</a>:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server (see config/lighttpd.conf for options)
Undefined config variable: var.CWD
2006-07-06 15:25:15: (configfile.c.800) source: config/lighttpd.conf line: 10 pos: 43 parser failed somehow near here: +
Exiting
%
</pre>
What is going wrong?
see LightTPDDoesn’tStartBecauseOfCWD
You are likely forgetting the “=” prefix before the tag. A form helper tag returns the generated html as a value, and does not output it to the page. Make sure your form tags and other helper tags are formatted as follows:
<%= text_field ‘object_name’, ‘name’ %>
not
<% text_field ‘object_name’, ‘name’ %>
the introductory pages say:
You’re running Ruby on Rails! Follow the instructions on http://0.0.0.0:3000.if you try going to http://0.0.0.0:3000 and get an error “The connection was refused when attempting to contact ”http://0.0.0.0">http://0.0.0.0:3000" like i did, try changing it to http://localhost:3000 or http://127.0.0.1:3000.