Hi there
I am trying to use ActiveScaffold (AS) for a new application for a new
branch of my company.
Firs of all. AS is just a FABULOUS plug-in, the potential and
customization are simple AWESOME. Congratulations boys.
Now to the trouble.
Background:
=========
Rails: 2.3.5
Ruby: 1.8.7
Gem: 1.3.5
Authlogic 2.1.3
Cancan 1.0.2
Locale: Spanish
application_controller.rb:
-----------------------------------
# stuff to authenticate user
ActiveScaffold.set_defaults do |config|
config.dhtml_history = false
end
users_controller.rb
---------------------------
active_scaffold :user do | config |
config.label
= ' '
# I use icons instead of the names of the actions
config.show.link.label
= '<img src="images/botones/mini/
ver.png">'
config.delete.link.label
= '<img src="images/botones/mini/
borrar.png">'
config.update.link.label
= '<img src="images/botones/mini/
editar.png">'
config.create.link.label
= 'Crear Usuario'
config.list.columns
=
[:id,:username,:login_count,:last_login_at, :rol]
config.list.sorting
= { :username => :asc }
config.columns[ :username ].label =
"Usuario"
config.columns[ :login_count ].label =
'Accesos'
config.columns[ :last_login_at ].label =
'Ultimo Acceso'
config.columns[ :rol ].label
= 'Nivel de Acceso'
config.list.empty_field_text
= 'n/d'
config.list.per_page
= 10
config.search.columns =
[ :username, :rol, :id, :last_login_at, :login_count ]
config.search.full_text_search = true
end
this is the model:
-------------------------
mysql> describe users;
| FIELD | TYPE | NULL | Key | Default | Extra
|
| id | int(11) | NO | PRI |
NULL | auto_increment |
| username | varchar(100) | NO | | NULL |
|
| crypted_password | varchar(250) | NO | | NULL
| |
| password_salt | varchar(250) | NO | | NULL
| |
| persistence_token | varchar(250) | NO | | NULL
| |
| login_count | int(11) | NO | | 0
| |
| failed_login_count | int(11) | NO | | 0
| |
| last_request_at | datetime | YES | | NULL |
|
| current_login_at | datetime | YES | | NULL
| |
| last_login_at | datetime | YES | | NULL |
|
| current_login_ip | varchar(45) | YES | | NULL
| |
| last_login_ip | varchar(45) | YES | | NULL
| |
| rol | varchar(20) | NO | |
visitante | |
| created_at | datetime | NO | | NULL
| |
| updated_at | datetime | NO | | NULL
| |
| lock_version | int(11) | NO | | 0
| |
I have also personalized the basic CSS into: public/stylesheets/
active_scaffold_overrides.css
In order to isolate the problem I copied vendor/plugins/
active_scaffold/frontend/default/views into my app/views/
active_scaffold_overrides
What happens:
===========
When I first load /users I get a perfect grid, just the way I want it.
But, when I do click in any of the column headings (to change the sort
order) or in the pagination navigation menu, I get the following
NoMethodError in Users#show
Showing app/views/active_scaffold_overrides/_show_columns.html.erb
where line #8 raised:
undefined method `created_at' for nil:NilClass
Extracted source (around line #8):
5: <% if column.is_a?
ActiveScaffold::DataStructures::ActionColumns
-%>
6: <%= render :partial => 'show_columns', :locals
=> {:columns =>
column} %>
7: <% else -%>
8: <%= show_column_value(@record, column) -%>
9: <% end -%>
10: </dd>
11: <% end -%>
Trace of template inclusion: app/views/active_scaffold_overrides/
_show.html.erb, app/views/active_scaffold_overrides/show.html.erb
RAILS_ROOT: /home/addicttux/Desarrollo/officeya
APPLICATION TRACE:
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/
whiny_nil.rb:52:in `method_missing'
/home/addicttux/Desarrollo/officeya/vendor/plugins/active_scaffold/lib/
active_scaffold/helpers/list_column_helpers.rb:146:in `send'
/home/addicttux/Desarrollo/officeya/vendor/plugins/active_scaffold/lib/
active_scaffold/helpers/list_column_helpers.rb:146:in
`format_column_value'
/home/addicttux/Desarrollo/officeya/vendor/plugins/active_scaffold/lib/
active_scaffold/helpers/list_column_helpers.rb:22:in
`get_column_value'
/home/addicttux/Desarrollo/officeya/vendor/plugins/active_scaffold/lib/
active_scaffold/helpers/show_column_helpers.rb:19:in
`show_column_value'
/home/addicttux/Desarrollo/officeya/app/views/
active_scaffold_overrides/_show_columns.html.erb:8:in
`_run_erb_app47views47active_scaffold_overrides47_show_columns46html46erb_locals_columns_object_show_columns'
/home/addicttux/Desarrollo/officeya/app/views/
active_scaffold_overrides/_show_columns.html.erb:2:in
`_run_erb_app47views47active_scaffold_overrides47_show_columns46html46erb_locals_columns_object_show_columns'
/home/addicttux/Desarrollo/officeya/app/views/
active_scaffold_overrides/_show.html.erb:3:in
`_run_erb_app47views47active_scaffold_overrides47_show46html46erb_locals_object_show'
/home/addicttux/Desarrollo/officeya/app/views/
active_scaffold_overrides/show.html.erb:3:in
`_run_erb_app47views47active_scaffold_overrides47show46html46erb'
Request
Parameters:
{"eid"=>"3a9feeb8bc3c07b4c88d1367b757b617",
"authenticity_token"=>"CeOmRpHnNgYgwEJGoSqHTRM7lEVxfeFwO+C5CFIPBhI=",
"id"=>"update_table",
"page"=>"1",
"sort"=>"login_count",
"sort_direction"=>"ASC"}
Show session dump
---
Response
Headers:
{"Content-Type"=>"text/html",
"Cache-Control"=>"no-cache"}
So I went to _show_columns.html.erb and add
8: <% begin %>
9: <%= show_column_value(@record, column) -%>
10: <% rescue %>
11: <% end %>
and I got the show screen, but I did not ask for it, I just was trying
to paginate or sort columns,
Any idea about what is wrong?
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.