So Montgomery Kosma,
def index
@timesheets = Timesheet.apply_scopes(:search => [params
[:search], :name], :order_by => parse_sort_param
(:name, :time, :client, :project, :user, :updated_at))
hobo_index @timesheets
I've got one little modification I'd like to make. the search only
looks at :name becuase that's stated here:
(:search => [params[:search], :name]
if I want to be able to search :name, :client, :project, and :user how
can I modify this? i tried just adding the fields, but that doesn't
work since client, project, and user are not @Timesheets, where I
already told it to look. Do I have to write another search method
inside index? How can I make it search across all models instead of
one model?
btw I get the following error message:
Mysql::Error: Unknown column 'timesheets.user' in 'where clause':
SELECT * FROM `timesheets` WHERE (((timesheets.name like '%CJ%') OR
(timesheets.user like '%CJ%') OR (timesheets.client like '%CJ%') OR
(timesheets.project like '%CJ%')))
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract_adapter.rb:188:in `log'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:309:in `execute'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/mysql_adapter.rb:563:in `select'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/database_statements.rb:7:in
`select_all_without_query_cache'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:60:in `select_all'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
connection_adapters/abstract/query_cache.rb:60:in `select_all'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:635:in `find_by_sql'
/usr/lib/ruby/gems/1.8/gems/hobo-0.8.7/lib/hobo/model.rb:293:in
`find_by_sql'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:1490:in `find_every'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:589:in `find'
/usr/lib/ruby/gems/1.8/gems/hobo-0.8.7/lib/hobo/model.rb:286:in `find'
/usr/lib/ruby/gems/1.8/gems/hobo-0.8.7/lib/hobo/scopes/
named_scope_extensions.rb:20:in `send'
/usr/lib/ruby/gems/1.8/gems/hobo-0.8.7/lib/hobo/scopes/
named_scope_extensions.rb:20:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:2003:in `with_scope'
(__DELEGATION__):2:in `__send__'
(__DELEGATION__):2:in `with_scope'
(__DELEGATION__):2:in `is_a?'
app/controllers/timesheets_controller.rb:9:in `index'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---