High interest - cold feet

lo there,

i have the book Agile development, and the PickAxe book. I am just
getting started with both ruby, and a demo project on rails from the
tutorial. I have a monstrosity of a site that i have designed for work.
I started the project a year ago, while i was learning php. The site
started as a simple way to get info to ag buisnessmen about current
status of their machines. Now, however, we have added new features, and
different functionality that makes the site very different from how it
started out. Firstly, its a mess. Everything was built in pieces that
do not really work together well. I want to do a complete rewrite. I
would love to do it in rails…
but… i have a couple of questions that concern me about it.

I like how so much stuff is automated in Rails. But the content of our
site now depends on a lot of conditionals.
if condition exist, do this formula and display results in this table
cell, if not do that formula, unless something else, then to do
something else. etc…
Is this kind of thing as easy to pull off in rails as it is in php? (
not that its really easy in php )

another question… after a huge site is built, if something new comes
along that we need to support, It will require more tables or more
cells. Will this mess anything up?

Lastly, one of the ways i am trying to sell this to my boss is by the
ease of use with ajax. I want to learn this to enhance our user
experience. We want this site to be world class, and after showing off
some sites to my employer, he was pretty excited about some of the
widgets for our site. Does rails really make it easier to do this ?

I am going to be learning rails eventually anyway for my own pet
projects. But if any of you have some feedback here on my concerns or
to quell my nervousness about this, I would really appreciate it a lot.

If you have read this far, i thank you for your time.

happy coding.
shawn

When you say “table cell” do you mean a html table, or a database
table?

If you mean that you’re displaying the data differently based on the
context - that’s super easy.

If you’re talking about doing lots of programming inside the database
using SQL conditionals - it may be possible, but isn’t the best idea
with rails.

Cheers
Starr

www.thebootstrapnation.com

no no, not programming the inside the database. I mean display of
different content inside table cells based on certain conditions.
Updating table rows based on conditions, etc…

thanks.
sk

What I’ve found is that almost everything is easier in Rails than PHP.
The fact that it separates everything out into views and controllers
makes putting the login into your pages so much easier. For instance, if
you want to display different views based on a condition:

def report
if [a condition]
render :action => ‘template1’
else
render :action => ‘template2’
end
end

You can also call partials from within your view if that is necessary to
display just a small piece of a page.
I’m currently on a project where I use ajax to update small sections of
a page every 10 seconds or so. You don’t have to use any javascript to
implement ajax functionality in rails apps.
Also, I know what you mean about PHP apps growing out of control. You
will not have that problem with rails as it’s so much better organized.

Good luck,

Jason

One minor lookout, Shawn – be sure you have given yourself a
sufficiently
long “runway” to learning + building your first RoR site(s). I found it
very
tough to get to the point where I could simply code some stuff “from my
head” rather than looking up how to do literally everything. There is so
much magic in Rails, but you really need to understand the magic before
you
can build sites beyond the 15-minute demo sites in the books and
screencasts. Like you I set out to build a complicated site as my first
project – quite a journey!

-Ryan

Well Jason,
i think you have provided sufficient ammo to go after this project as
a rails rewrite.
I have one last thing.

this website is for three different companies. three different domains
point to three different sites on our virtual host. I want to combine
all three into one web folder. That way, if I update something, I only
have to do it once. Now, I could have all three sites point to to the
same folder from the apache config, however, each site needs different
logos. There are also some minor differences on which info is displayed
( that i could work around ) but in order to share code, i need to have
a variable that tells me which domain was accessed to get there.
I know that this can be done. Do you have a good reccomendation about
how to do that ? I think mongrel may help me out. Don’t know for sure.

thanks for your help on this, by the way. Whether i can use all the
same code for all three sites or not, i certainly am wanting to do it
in rails.

cheers.
shawn

no blog postings - I don’t get to do Rails as my day job (yet) so it’s
been
night work over the past 6 months, I actually restarted the site 2x as I
learned new things and as Rails developed (for instance, the recent rise
of
RJS + REST). But I’m actually getting the hang of it a bit now, it’s
exciting! :slight_smile:

The tough part for me is that the edge rails stuff is very cool, but not
nearly as well-documented as 1.1, and unfortunately for me my
personality
draws me towards the edge far too often. So it’s a struggle to find good
documentation + examples.

I’ve bought books (Pickaxe, AWDwR 1 + 2, Ruby for Rails, Cody F.'s
RJS
ebook, Rails Recipes) and even a screencast ($9 RJS screencast @
www.peepcode.com - Geoff is coming out with a REST screencast, too,
soon, I
hear.) Actually a blog posting might be theraputic for me :slight_smile:

-Ryan

On 10/7/06, nephish [email protected] wrote:

have to do it once. Now, I could have all three sites point to to the
same folder from the apache config, however, each site needs different
logos. There are also some minor differences on which info is displayed
( that i could work around ) but in order to share code, i need to have
a variable that tells me which domain was accessed to get there.
I know that this can be done. Do you have a good reccomendation about
how to do that ? I think mongrel may help me out. Don’t know for sure.

When you get to this part, where you need to seperate out the
functionality,
perhaps you can use a different layout for each, or just store a logo
image
in the company information. before_filters can be used to set things at
the
start of the request so that the logic is set for the rest

thanks for your help on this, by the way. Whether i can use all the

yeah, each thing i learn has a huge learning curve. I like this kinda
stuff
a lot, but it all comes with a price. We have a test domain where we set
everything up for fake till it works, then point the server at it. I
mainly
wanted to know that all this is possible and worth the move to rails,
which
i am thinking more and more that it is.

thanks for your time here, by the way. I wouldn’t mind hearing about
your
journey though. Did you blog it somewhere ? Might save me some pain.

cheers, Ryan !

shawn

Well thanks, I had not really thought of a company info table before,
but it
would make a lot of sense. The trick i don’t know how to pull off is how
to
have code shared between sites, while at the same time have domain1.com
pull
a different display in logos, etc. while domain2.com will pull something
different. Still keeping all of the logic in place.

thanks.

shawn

On 10/8/06, shawn bright [email protected] wrote:

Well thanks, I had not really thought of a company info table before, but
it would make a lot of sense. The trick i don’t know how to pull off is how
to have code shared between sites, while at the same time have domain1.compull a different display in logos, etc. while
domain2.com will pull something different. Still keeping all of the logic
in place.

thanks.

shawn

I’m not really 100% on what your after.

Checkout the account_location plugin
http://dev.rubyonrails.org/svn/rails/plugins/account_location/

This will help you to identify the domain that your using. In fact I’m
not
sure that you need this to determine your domain but it does make it
nice.

You can include this in the application_controller as a before filter so
that everytime someone accesses an action, it the domain is identified
an
put into a method/varaible so that you can use it easily anywhere in the
controller / view of the action.

I believe you can also set a different layout in a before_filter so that
depending on the domain, you can apply a different layout. (I’m not
completely sure on this but I think so)

so you might do something like

class ApplicationController < ActionController
before_filter :set_domain_variable

def set_domain_variable
# logic in here to set the domain
self.class.layout = “some_domain_layout”
end
end

the layout method is a class method of the controller.

Hope that’s something like what your after

YES ! this is exactly what i am after !
thanks very much. This should make it work.
way cool.

shawn

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs