You should really read basics about variable types in ruby.
All your $... vars are globals. It's not threadsafe and really hugly.
You should really learn to give readable names to your vars
$elementspro = params[:elementprovince]
:conditions => "province=" + $elementspro
:conditions => "province=" + params[:elementprovince]
???. your code will be more readable and threadsafe
:conditions => "province=" + $element
:conditions => ['province = :elementprovince', params]
??? your code will be more readable AND SAFE!!!
I agree with Michael, you clearly come from php. Ruby is not php.
First, there's threads like in any other correct language and it means
you have to handle with.
Second, in rails, every good practice is often (always?!) simpler to
use than bad practice. Every rails tutorial use good SQL practice, why
Even your html is ugly.
- Instead of millions of checkboxes, use multiple lists
- Don't use divs (or anything else) out of body
- Don't declare body anywhere else than in your layouts
- Don't use logic in view (page = params[:page]) => will_paginate
handle nil params[:page] for you
- Use cool syntax like: page = params[:page] || 1
- Don't use table, unless for tabular data presentation (table is a
table, not a visual tool)
- Don't use style propertie in html, use css in separated css file(s)
NEVER USE GLOBAL VARS! it's really rare when you can justify of their
I think you're clearly not ready to use mvc and oop, go read manuals.
You just proved, another time, that most of php coders suck.