# Help about CMS - newbie in RoR

**URL:** <https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017>\
**Category:** Rails\
**Created:** [May 30, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017 "2006-05-30T20:29:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSASMartSSS\_nSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@SSASMartSSS\_nSSS](https://www.ruby-forum.com/u/SSASMartSSS_nSSS)\
**Post date:** [May 30, 2006, 8:29pm UTC](https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017/1 "2006-05-30T20:29:36Z")

</div>

Hi team, I’m a very newbie RoR user from Spain and I’m developing a  
blog’s CMS. Why RoR?, coz I think it’s an amazing framework with many  
posibilities, portable and really powerful, with a young and optimist  
community, and taking my project I’ve prefered his structure in front of  
LAMP. Another thing is that I’ve liked to surprise my masters with this  
novel framework. I wish come here to contribute when my application is  
finished and when my knowledge in RoR grows.

By now I need some basic help (some directives) about blog creation.  
I’ve developed account administration with auth\_generator plugin and  
touching some code, but I don’t know how can I make every user will  
create and configure only one blog at a time (it’s 1 user = 1 blog, 1:1  
relation).

CONSIDERATIONS:

1 user has 1 blog  
1 blog has 1 style and belongs to 1 category  
1 blog has many articles  
1 blog has many links  
1 article has many comments

MySQL database script:

DROP TABLE IF EXISTS `users`;  
CREATE TABLE `users` (  
`id` int(11) NOT NULL auto\_increment,  
`login` varchar(80) character set latin1 default NULL,  
`cryptpassword` varchar(40) character set latin1 default NULL,  
`validkey` varchar(40) character set latin1 default NULL,  
`email` varchar(100) character set latin1 NOT NULL default ‘’,  
`newemail` varchar(100) character set latin1 default NULL,  
`ipaddr` varchar(15) character set latin1 NOT NULL default ‘’,  
`created_at` datetime NOT NULL default ‘0000-00-00 00:00:00’,  
`updated_at` datetime NOT NULL default ‘0000-00-00 00:00:00’,  
`confirmed` tinyint(1) NOT NULL default ‘0’,  
`domains` text character set latin1 collate latin1\_bin NOT NULL,  
`image` text character set latin1,  
`firstname` varchar(40) character set latin1 NOT NULL default ‘’,  
`lastname` varchar(40) character set latin1 NOT NULL default ‘’,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `blogs`;  
CREATE TABLE `blogs` (  
`id` int(11) NOT NULL auto\_increment,  
`category_id` int(11) NOT NULL,  
`style_id` int(11) NOT NULL,  
`title` varchar(255) character set latin1 default NULL,  
`url` varchar(255) character set latin1 default NULL,  
`created_at` datetime default NULL,  
`updated_at` datetime default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `articles`;  
CREATE TABLE `articles` (  
`id` int(11) NOT NULL auto\_increment,  
`title` varchar(255) character set latin1 default NULL,  
`excerpt` text character set latin1,  
`body` text character set latin1,  
`allow_comments` tinyint(1) NOT NULL default ‘1’,  
`published` tinyint(1) NOT NULL default ‘1’,  
`created_at` datetime default NULL,  
`updated_at` datetime default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `comments`;  
CREATE TABLE `comments` (  
`id` int(11) NOT NULL auto\_increment,  
`blog_id` int(11) NOT NULL,  
`email` varchar(150) character set latin1 default NULL,  
`author` varchar(255) character set latin1 default NULL,  
`body` text character set latin1,  
`created_at` datetime default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `categories`;  
CREATE TABLE `categories` (  
`id` int(11) NOT NULL auto\_increment,  
`name` varchar(255) character set latin1 default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `styles`;  
CREATE TABLE `styles` (  
`id` int(11) NOT NULL auto\_increment,  
`name` varchar(255) character set latin1 default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

DROP TABLE IF EXISTS `links`;  
CREATE TABLE `barbatos`.`links` (  
`id` int(11) NOT NULL auto\_increment,  
`name` varchar(255) character set latin1 default NULL,  
`url` varchar(150) character set latin1 default NULL,  
PRIMARY KEY (`id`)  
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1\_spanish\_ci;

After creating scaffold with script generator I’ve touched models like  
this:  
/app/models/blog.rb  
class Blog \< ActiveRecord::Base  
belongs\_to :category  
belongs\_to :user  
…  
end

/app/models/user.rb  
class User \< ActiveRecord::Base  
has\_one :blog  
…  
end

And at the end I’ve touched auth\_generator account menu (from layout)  
adding a link to new blog:

 ... \<%= if @user and @user.ident == true link\_to(image\_tag("#{@app['controller\_name']}/letsblog", :border =\> 0), {:controller =\> "admin/blog", :action =\> "new" } ) end %\>

But any user can create infinite blogs from his link on menu and can  
list and edit other user’s blogs using navigator’s bar. List option  
problem is easy to resolve by erasing this action on blog’ controller,  
but not so about edit and create options.

Thanks to all, and I wish my newbie problems and my english won’t  
suppose an annoyance to you 🙂

* * *

LLama Gratis a cualquier PC del Mundo.  
Llamadas a fijos y móviles desde 1 céntimo por minuto.  
[http://es.voice.yahoo.com](http://es.voice.yahoo.com)

---

<div class="post-metadata">

**Author:** ![SSASMartSSS\_nSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@SSASMartSSS\_nSSS](https://www.ruby-forum.com/u/SSASMartSSS_nSSS)\
**Post date:** [May 30, 2006, 9:32pm UTC](https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017/2 "2006-05-30T21:32:36Z")

</div>

A. Martín schrieb:

> touching some code, but I don’t know how can I make every user will  
> create and configure only one blog at a time (it’s 1 user = 1 blog,  
> 1:1 relation).  
> Buenos dias,

I would recommend you get a copy of “Typo”, that is a railsBlogSystem  
and a copy of one of the CMS appraoches allready started

Looking at their code, structure etc would be the best way to see how  
you can reach your goal using rails…

Pues nada mas,

regards

matthi

---

<div class="post-metadata">

**Author:** ![SSASMartSSS\_nSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@SSASMartSSS\_nSSS](https://www.ruby-forum.com/u/SSASMartSSS_nSSS)\
**Post date:** [May 30, 2006, 11:49pm UTC](https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017/3 "2006-05-30T23:49:51Z")

</div>

matthibcn  
escribió:

> regards
> 
> matthi

OK, I’ll take a look and check it out. Before installing I need to  
configure a php server which I have not.

merci matthi 🙂

* * *

LLama Gratis a cualquier PC del Mundo.  
Llamadas a fijos y móviles desde 1 céntimo por minuto.  
[http://es.voice.yahoo.com](http://es.voice.yahoo.com)

---

<div class="post-metadata">

**Author:** ![SSASMartSSS\_nSSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/45deac/32.png) [@SSASMartSSS\_nSSS](https://www.ruby-forum.com/u/SSASMartSSS_nSSS)\
**Post date:** [May 31, 2006, 12:33am UTC](https://www.ruby-forum.com/t/help-about-cms-newbie-in-ror/62017/4 "2006-05-31T00:33:11Z")

</div>

A.  
Martín escribió:

> > regards
> > 
> > matthi
> 
> OK, I’ll take a look and check it out. Before installing I need to  
> configure a php server which I have not.
> 
> merci matthi 🙂

ADVICE: Instant Rails has a Typo project on board, so it isn’t necesary  
installing an Apache server 🙂

* * *

LLama Gratis a cualquier PC del Mundo.  
Llamadas a fijos y móviles desde 1 céntimo por minuto.  
[http://es.voice.yahoo.com](http://es.voice.yahoo.com)
