Forum: Ruby on Rails Don't name a tinyint(1) field "open"?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
69f7fa8d94b3f993ab7a5923a28cb597?d=identicon&s=25 Shawn Oster (soster)
on 2005-12-14 09:19
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
67b6389be42524fbd776e44fd35c3d7e?d=identicon&s=25 Peter Donald (Guest)
on 2005-12-14 10:04
(Received via mailing list)
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 <column>? 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 Donald

Blog: http://www.RealityForge.org
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 10:32
(Received via mailing list)
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
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 20:25
(Received via mailing list)
No love?

:o(
9b995363bb34f302bdd7705b8490e07a?d=identicon&s=25 Scott Phelps (Guest)
on 2005-12-14 20:37
(Received via mailing list)
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.
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 20:58
(Received via mailing list)
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
9b995363bb34f302bdd7705b8490e07a?d=identicon&s=25 Scott Phelps (Guest)
on 2005-12-14 21:22
(Received via mailing list)
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!
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 21:37
(Received via mailing list)
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
9b995363bb34f302bdd7705b8490e07a?d=identicon&s=25 Scott Phelps (Guest)
on 2005-12-14 22:11
(Received via mailing list)
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.
4bd34a2216dc8bdbf1f017f64e4d59e8?d=identicon&s=25 Kyle Maxwell (Guest)
on 2005-12-14 22:14
(Received via mailing list)
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
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 22:32
(Received via mailing list)
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)
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-14 23:44
(Received via mailing list)
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
Ad91bce9c9a8c68b6942607e4721f74e?d=identicon&s=25 Beate Paland (Guest)
on 2005-12-14 23:59
(Received via mailing list)
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 ;)

regards,
Beate
3a5e1c6415698023b2a3eafdadc34b0c?d=identicon&s=25 Samo Korosec (Guest)
on 2005-12-15 00:08
(Received via mailing list)
Thanks! Will see how I make progress and if it goes well, I'll
probably release it anyway. :o)
B45eab4f18aa1bb2a44d6e657531a642?d=identicon&s=25 Alain Ravet (aravet)
on 2005-12-15 01:16
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.
This topic is locked and can not be replied to.