Hello to everyone,
I''m new in Ruby on Rails (in ruby too ;-)) and I''m not
speak/write English too
well, so sorry.
I start learning converting an application in php to RoR,
this application is a kind of Hotel Bookings System. The php application
don''t
fit in my needs, so I started from zero my application in RoR.
What I want is to know if the php application''s logic fit on
RoR''s logic, or is
there any other way to do this.
Let''s begin!
THE PHP APPLICATION LOGIC:
1. As admin, I create a year: 2005
2. This year created, has a range: from January 1st, 2005 to August 16th, 2006
or January 15st, 2005 to February 15, 2005 (A year could have a maximum of 28
months)
3. The application create a table with this range and callit: period2005. It has
a id field, start_date field, and an end_date field for every day in the range
(for example: id:1 star_date: 2005/01/01 end_date: 2005/01/02.
4. The application generate a file (.php) and call it: selectYear.user.php
(select2005.1.php), the admin is the user 1, in this file writes this:
<?php
echo "
<option value=\"2005-01-01\"$sel20050101>Ene 01 Sa,
2005</option>
<option value=\"2005-01-02\"$sel20050102>Ene 02 Do,
2005</option>
<option value=\"2005-01-03\...
5. As admin, I active this year for some of the users. So, the application
generate a file: select2005.N.php for those users.
6. When the user X login, he only can make a reservation between his active
range of dates, because the application load the range from period2005.X.php.
On the application you only can make a reservation on a previously created year.
And only can work with 1 year. If you want to change to next year, you have to
load it.
Is there a better logic on Ruby/Rails?
I hope you could understand what I mean.
Thank you in advance,
Jorge
Hello Jorge! I''ve never done this kind of dynamic table or application code generation either, but I don''t think it is a good idea. How about settling for a few fixed number of tables and go one from there. So instead of tables like period2004, period2005, period2006 you will have one periods table counting all years. And you would have an URL like select.php/user_name/2005 instead of dynamically generating code for each year, user combination. Just a thought, Zsombor On 6/7/05, Jorge Mesa <jorge.mesa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello to everyone, > > I''m new in Ruby on Rails (in ruby too ;-)) and I''m not speak/write English too > well, so sorry. > > I start learning converting an application in php to RoR, > this application is a kind of Hotel Bookings System. The php application don''t > fit in my needs, so I started from zero my application in RoR. > > What I want is to know if the php application''s logic fit on RoR''s logic, or is > there any other way to do this. > > Let''s begin! > > THE PHP APPLICATION LOGIC: > > 1. As admin, I create a year: 2005 > > 2. This year created, has a range: from January 1st, 2005 to August 16th, 2006 > or January 15st, 2005 to February 15, 2005 (A year could have a maximum of 28 > months) > > 3. The application create a table with this range and callit: period2005. It has > a id field, start_date field, and an end_date field for every day in the range > (for example: id:1 star_date: 2005/01/01 end_date: 2005/01/02. > > 4. The application generate a file (.php) and call it: selectYear.user.php > (select2005.1.php), the admin is the user 1, in this file writes this: > <?php > echo " > <option value=\"2005-01-01\"$sel20050101>Ene 01 Sa, 2005</option> > <option value=\"2005-01-02\"$sel20050102>Ene 02 Do, 2005</option> > <option value=\"2005-01-03\... > > 5. As admin, I active this year for some of the users. So, the application > generate a file: select2005.N.php for those users. > > 6. When the user X login, he only can make a reservation between his active > range of dates, because the application load the range from period2005.X.php. > > On the application you only can make a reservation on a previously created year. > And only can work with 1 year. If you want to change to next year, you have to > load it. > > Is there a better logic on Ruby/Rails? > > I hope you could understand what I mean. > > Thank you in advance, > Jorge > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- http://deezsombor.blogspot.com
Thank you, I was thinking about it, too. 2005/6/7, Dee Zsombor <dee.zsombor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Hello Jorge! > > I''ve never done this kind of dynamic table or application code > generation either, but I don''t think it is a good idea. How about > settling for a few fixed number of tables and go one from there. So > instead of tables like period2004, period2005, period2006 you will > have one periods table counting all years. And you would have an URL > like select.php/user_name/2005 instead of dynamically generating code > for each year, user combination. > > Just a thought, > Zsombor > > > On 6/7/05, Jorge Mesa <jorge.mesa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello to everyone, > > > > I''m new in Ruby on Rails (in ruby too ;-)) and I''m not speak/write > English too > > well, so sorry. > > > > I start learning converting an application in php to RoR, > > this application is a kind of Hotel Bookings System. The php application > don''t > > fit in my needs, so I started from zero my application in RoR. > > > > What I want is to know if the php application''s logic fit on RoR''s > logic, or is > > there any other way to do this. > > > > Let''s begin! > > > > THE PHP APPLICATION LOGIC: > > > > 1. As admin, I create a year: 2005 > > > > 2. This year created, has a range: from January 1st, 2005 to August > 16th, 2006 > > or January 15st, 2005 to February 15, 2005 (A year could have a maximum > of 28 > > months) > > > > 3. The application create a table with this range and callit: > period2005. It has > > a id field, start_date field, and an end_date field for every day in the > range > > (for example: id:1 star_date: 2005/01/01 end_date: 2005/01/02. > > > > 4. The application generate a file (.php) and call it: > selectYear.user.php > > (select2005.1.php), the admin is the user 1, in this file writes this: > > <?php > > echo " > > <option value=\"2005-01-01\"$sel20050101>Ene 01 Sa, 2005</option> > > <option value=\"2005-01-02\"$sel20050102>Ene 02 Do, 2005</option> > > <option value=\"2005-01-03\... > > > > 5. As admin, I active this year for some of the users. So, the > application > > generate a file: select2005.N.php for those users. > > > > 6. When the user X login, he only can make a reservation between his > active > > range of dates, because the application load the range from > period2005.X.php. > > > > On the application you only can make a reservation on a previously > created year. > > And only can work with 1 year. If you want to change to next year, you > have to > > load it. > > > > Is there a better logic on Ruby/Rails? > > > > I hope you could understand what I mean. > > > > Thank you in advance, > > Jorge > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > -- > http://deezsombor.blogspot.com > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails