2010/9/16 Iñaki Baz Castillo <[email protected]>:
> 2010/9/16 Iñaki Baz Castillo <[email protected]>:
>> Strange, I've upgraded today to master branch and the issue doesn't occur.
>
> Sorry, the problem still occurs with AS master branch. Sorry for my
> previous mail.
To summarize:
- rails 2.3.9
- devise 1.0.8 (the version for rails 2.3)
Using devise authentication framework is very easy, just run (in rails 2.3):
ruby script/generate devise_install
ruby script/generate devise WebUser
- In config/routes.rb write "map.devise_for :web_users". This
generates some methods as "authenticate_web_user",
"web_user_signed_in?" and so on.
- In controllers/application_controller.rb write "before_filter
:authenticate_web_user!".
- I have created a AdminWebUsersController with AS support in routes.rb.
class AdminWebUsersController < ApplicationController
active_scaffold :web_users do |config|
[...]
Then I can manage web_users entries with AS using /admin_web_users_controller.
Ok, with today's AS (rails-2.3 backwards compatible) I can:
- Get the the list view of AdminWebUsersController (as any other AS controller).
- Create a new WebUser entry in AdminWebUsersController.
- Update/delete it.
With today's AS (master branch) I can:
- Get the the list view of AdminWebUsersController (as any other AS controller).
But I cannot create/delete/modify any entry in the list of
AdminWebUsersController. When I try it I get this error:
-----------------------------------------------------------
Processing AdminWebUsersController#edit (for X.X.X.X at 2010-09-16
23:28:30) [GET]
Parameters: {"action"=>"edit", "_method"=>"get",
"adapter"=>"_list_inline_adapter", "id"=>"27",
"controller"=>"admin_web_users"}
WebUser Load (1.9ms) SELECT * FROM `web_users` WHERE
(`web_users`.`id` = 11) LIMIT 1
WebUser Load (1.8ms) SELECT * FROM `web_users` WHERE
(`web_users`.`id` = 27)
ActionView::TemplateError (Could not find ::WebUsersController or
::WebUserController or WebUsersController or WebUserController) on
line #14 of
vendor/plugins/active_scaffold/frontends/default/views/_form.html.erb:
11: </li>
12: <% else -%>
13: <li class="form-element <%= 'required' if column.required? %>
<%= column.css_class unless column.css_class.nil? %>">
14: <%= render :partial => form_partial_for_column(column),
:locals => { :column => column } -%>
15: </li>
16: <% end -%>
17: <% end -%>
vendor/plugins/active_scaffold/lib/active_scaffold/helpers/view_helpers.rb:29:in
`active_scaffold_controller_for'
vendor/plugins/active_scaffold/lib/active_scaffold/helpers/form_column_helpers.rb:233:in
`override_form_field_partial'
vendor/plugins/active_scaffold/lib/active_scaffold/helpers/form_column_helpers.rb:227:in
`override_form_field_partial?'
vendor/plugins/active_scaffold/lib/active_scaffold/helpers/form_column_helpers.rb:263:in
`form_partial_for_column'
vendor/plugins/active_scaffold/frontends/default/views/_form.html.erb:14
vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_columns.rb:77:in
`each'
vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_columns.rb:64:in
`each'
vendor/plugins/active_scaffold/frontends/default/views/_form.html.erb:2
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.9/lib/action_view/renderable.rb:34:in
`send'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.9/lib/action_view/renderable.rb:34:in
`render_without_active_scaffold'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.9/lib/action_view/base.rb:306:in
`with_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.3.9/lib/action_view/renderable.rb:30:in
`render_without_active_scaffold'
vendor/plugins/active_scaffold/lib/extensions/action_view_rendering.rb:94:in
`render'
-----------------------------------------------------------
Then, in both cases (both AS versions) I've run the script/console and
realized that neither WebUsersController or WebUserController doesn't
seem to exist.
-------------------------------------------------------
>> WebUsersController
NameError: uninitialized constant WebUsersController
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:469:in
`load_missing_constant'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:106:in
`const_missing'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:118:in
`const_missing'
from (irb):5
>> WebUserController
NameError: uninitialized constant WebUserController
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:469:in
`load_missing_constant'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:106:in
`const_missing'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.9/lib/active_support/dependencies.rb:118:in
`const_missing'
from (irb):6
-------------------------------------------------------
However this occurs in *both* AS versions (the working one and the
failing one). I don't understand why AS is trying to render stuff
related to WebUsersController. IMHO AS just should handle
AdminWebUsersController, am I wrong?
And finally I've got it working with AS master branch by doing an ugly hack:
- I've created a controllers/web_users_controllers.rb with AS empty stuff:
class WebUsersController < ApplicationController
active_scaffold :web_users do |config|
end
end
- I've added "map.resources :web_users, :active_scaffold => true" in routes.rb.
And it works :)
So I strongly think this is a bug in AS master branch as AS doesn't
need, at all, to render web_users_controller.
--
Iñaki Baz Castillo
<[email protected]>
--
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.