Don't name a tinyint(1) field "open"?

Ok, through extreme trial and error I’ve managed not to bug this list
(and I’m a Windows guy that managed to install Rails on my ISP’s Apache
VirtualHost with symlinks to get it working inside a PHP app) but this
one has me stumped.

I learned that Rails turns tinyint(1) fields into boolean but I don’t
see why the “generate scaffold” fails when a field is named “open”. If
I change the name it’s fine, if I change the field type it’s also fine.
It’s only this magic combination of naming a field “open” when it’s a
tinyint(1).

when I call:
./script/generate scaffold MyClass

I get some files and then:
wrong number of arguments (0 for 1)

I know the workaround but some questions:

  1. Would there have been a better way to debug the error? Seems sorta
    vague and left me hanging, not knowing where to look.

  2. Is there a doc that specifies all these ActiveRecord auto-behaviours
    in a summary format (vs. being spread across 10 different places?)

  3. Could I prevent “generate scaffold” from turning my tinyint into a
    boolean if I wanted? Not that I do but I’m curious.

Thanks,
Shawn Oster

Hi,

I didn’t look into the cause but I would guess that there is a method
named open? in ActiveRecord or a related class. When you add a boolean
column a method named ? is added. Thus when your model adds a
column named open that is boolean, open? will be generated and this
will conflict with the AR method.

HTH


Cheers,

Peter D.

Blog: http://www.RealityForge.org

Hiya,

I hope this is the right place to ask. I’m new to Ruby and Rails and
after some of the demos I saw I want to make my next CMS with Rails.
The idea behind using Rails is basically to have the Rails CMS run
locally on the customer’s intranet/computer and synchronising it with
their website as needed. The reason for the more “complicated”
approach is the tendency of customers to have “their” webspace
providers run anything from Linux/PHP/MySQL only to Windows/PHP/MSSQL
and I don’t want to rewrite the CMS all the time - plus they have an
up to date version of their website for backup at all times.

So the questions: Is something like that feasible? I tought of
uploading new content via FTP and sending an update to MySQL directly
or even uploading an XML file and loading that into MySQL via PHP/
Whatever. Are there ways to simply synchronise/access the remote (My)
SQL database and upload the neccessary data via FTP? Do you guys have
any pointers where I should look for the relevant information or
which functions/functionality I should look up in the documentation?
Are there any special situations to consider or does anyone have
experience with something similiar?

I hope that’s not too vague/newbish, have a nice day everyone!
Samo

No love?

:o(

On Dec 14, 2005, at 2:24 PM, Samo Korosec wrote:

So the questions: Is something like that feasible? I tought of
uploading new content via FTP and sending an update to MySQL
directly or even uploading an XML file and loading that into MySQL
via PHP/Whatever. Are there ways to simply synchronise/access the
remote (My)SQL database and upload the neccessary data via FTP? Do
you guys have any pointers where I should look for the relevant
information or which functions/functionality I should look up in
the documentation? Are there any special situations to consider or
does anyone have experience with something similiar?

This is kinda vague. Depending on the content you could simply use
SOAP to perform the necessary RPC’s between these distributed processes.

On Dec 14, 2005, at 8:36 PM, Scott Phelps wrote:

version of their website for backup at all times.
something similiar?

This is kinda vague. Depending on the content you could simply use
SOAP to perform the necessary RPC’s between these distributed
processes.

It’s vague because I have a bunch of different platforms to
potentially deal with, most of the time with very limited options to
adapt said systems. :o)

My thinking was to simply keep track of what has been updated and
either generate SQL or an XML file of the content and articles. Then
those would be parsed on the server and the media would be uploaded
via FTP. Where I was unsure is whether the FTP and MySQL-related
functionality is there (in Ruby and Rails), so I can simply present
the user a “synchronise” button and the data is pushed. I don’t need
realtime synchronisation and would prefer to keep as much as possible
in Ruby/Rails, so I can deploy it with the customer without the need
to rewrite the CMS all the time for different hosting solutions.

And of course it has to be done yesterday, so a simple solution would
be best.

Thanks for the response!
Samo

On Dec 14, 2005, at 2:57 PM, Samo Korosec wrote:

version of their website for backup at all times.
something similiar?

This is kinda vague. Depending on the content you could simply use
SOAP to perform the necessary RPC’s between these distributed
processes.

It’s vague because I have a bunch of different platforms to
potentially deal with, most of the time with very limited options to
adapt said systems. :o)

My thinking was to simply keep track of what has been updated and
either generate SQL or an XML file of the content and articles. Then
those would be parsed on the server and the media would be uploaded
via FTP. Where I was unsure is whether the FTP and MySQL-related
functionality is there (in Ruby and Rails),

Rails is not SQL specific it uses the Active Record ORM.
As far as FTP - that is not a function (api) in any languages I know
of. You’ll have to write it in Ruby or use post data for uploads.

so I can simply present the user a “synchronise” button and the
data is pushed. I don’t need realtime synchronisation and would
prefer to keep as much as possible in Ruby/Rails, so I can deploy
it with the customer without the need to rewrite the CMS all the
time for different hosting solutions.

And of course it has to be done yesterday, so a simple solution
would be best.

LOL!

On Dec 14, 2005, at 9:20 PM, Scott Phelps wrote:

Rails is not SQL specific it uses the Active Record ORM.

Ah, so I’d need to generate the SQL with MySQL. That’s ok, I can keep
track of the row IDs and get those then.

As far as FTP - that is not a function (api) in any languages I
know of. You’ll have to write it in Ruby or use post data for
uploads.

Well it’s part of the APIs used with Cocoa (CoreFoundation, CFFTP)
and PHP also offers functions to upload open files via FTP (ftp_put),
so I tought it’s part of the Ruby installation (or availible as a gem).

And of course it has to be done yesterday, so a simple solution
would be best.

LOL!

Tell me about it… :-/

Thanks anyhow!
Samo

Why are you wanting to develop yet another CMS? There are hundreds,
possibly thousands, of OSS and commercial CMS’s available. Surely one
of them does what you want. If not, then find an OSS one and modify
it. Off the top of my head, Macromedia/Adobe Contribute and Fog Creek
Citydesk would be the closest matches to what you envision. I don’t
know of their OSS equivalents.

Kyle

On Dec 14, 2005, at 3:35 PM, Samo Korosec wrote:

know of. You’ll have to write it in Ruby or use post data for
uploads.

Well it’s part of the APIs used with Cocoa (CoreFoundation, CFFTP)
and PHP also offers functions to upload open files via FTP
(ftp_put), so I tought it’s part of the Ruby installation (or
availible as a gem).

That was dumb of me to say that. Ruby has it!

http://www.ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/

I didn’t know PHP had that too, cool.

Heh, I just found that, too. Now I need a solution for the database
data, but that one wont be that hard.

Thanks for the time and the inspiration to actually hit up the
documentation! ;o)

I want something that can drive Flash and HTML websites, that is easy
to use and looks great (I only just started - http://www.froodee.net/
misc/cms_ui_01.jpg ). With Rails I think the development can be
simplified quite a bit and with AJAX and script.aculo.us I can
actually make a useable Interface for it.

I only need simple articles, media files and galleries for now, but
later on I want to be able to extend it with a media management
system, product database and catalogue system with the ability to
generate print-ready PDFs. The fields I work in (marketing agencies,
architecture bureaus, etc) would welcome simple solutions for that
and of all the CMS systems I reviewed most seem to be done by
programmers who stuff them full of features the secretary responsible
for updating the company website will only get a heart attack from.
And I think adapting one of those systems to suit my needs (and
possibly maintaining a fork after that) would take as long if not
longer than writing a simple one from scratch would.

Besides, any excuse to propagate the useage of Rails is good enough
for me. ;o)

I know that “I R write teh CMS” sounds just like game developers who
want to develop their own engine instead of using something that is
already there and works just as well, but I considered a few
solutions already and none of them works for me.

Samo

Thanks! Will see how I make progress and if it goes well, I’ll
probably release it anyway. :o)

Hi Samo,

screenshot lookes nice! And your idea is also nice, I think, if the
customers are satisfied with static pages (no dynamic content like
contact forms). And I agree with you that modifying a existing system
takes as long as coding new (I thought about this with an online shop
recently).

So I’d like to encourage you doing this in rails and please keep us
informed about further goings :wink:

regards,
Beate

Samo,

Next time, please create a new thread.
By hijacking an existing thread, your question will be invisible to all
people who don’t read/hide the master thread.

Alain.