vhochstein / active_scaffold Goto Github PK
View Code? Open in Web Editor NEWThis project forked from activescaffold/active_scaffold
Rails 4 Version of activescaffold supporting jquery
License: MIT License
This project forked from activescaffold/active_scaffold
Rails 4 Version of activescaffold supporting jquery
License: MIT License
upgraded from rails 2.3.8 to 3.0.0 and switched from 'official' active scaffold branch to this one, using jquery 1.4.1, and everything works except deleting.
seems like its going to the wrong action
Started DELETE "/events?active_scaffold=true&id=3" for 127.0.0.1 at Tue Oct 05 19:18:37 -0700 2010
Processing by EventsController#index as JS
Parameters: {"id"=>"3", "active_scaffold"=>"true"}
shouldn't it be going to the delete action?
hi.....
i am trying to upgrade my rails project from 2.3.8 to rails 3.I had used active_scaffold in my rails 2.3.8 version but its not working this time.I went through your post and installed the render_component and verification plugins but still when i am trying to start my server,its throwing an error.I am providing you the complete back trace of the error encountered....
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/core_ext/module/aliasing.rb:31:in alias_method': undefined method
options' for class ActionController::Resources::Resource' (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/core_ext/module/aliasing.rb:31:in
alias_method_chain'
from /home/skar/kreeti/meshing/mesh/vendor/plugins/active_scaffold/lib/extensions/resources.rb:20
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency' from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in
new_constants_in'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in load_dependency' from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
require'
from /home/skar/kreeti/meshing/mesh/vendor/plugins/active_scaffold/environment.rb:4
from /home/skar/kreeti/meshing/mesh/vendor/plugins/active_scaffold/environment.rb:4:in each' from /home/skar/kreeti/meshing/mesh/vendor/plugins/active_scaffold/environment.rb:4 from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
require'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in
load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in new_constants_in' from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in
load_dependency'
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in require' from /home/skar/kreeti/meshing/mesh/vendor/plugins/active_scaffold/init.rb:8 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/plugin.rb:81 from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in
instance_exec'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:25:in run' from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:50:in
run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in each' from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/initializable.rb:49:in
run_initializers'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:134:in initialize!' from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in
send'
from /usr/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:77:in method_missing' from /home/skar/kreeti/meshing/mesh/config/environment.rb:5 from /home/skar/kreeti/meshing/mesh/config.ru:3:in
require'
from /home/skar/kreeti/meshing/mesh/config.ru:3
from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in instance_eval' from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in
initialize'
from /home/skar/kreeti/meshing/mesh/config.ru:1:in `new'
from /home/skar/kreeti/meshing/mesh/config.ru:1
plz hlp..........
I don't know whether this is a problem in the Rails 3 branch or with ActiveScaffold in general, but ...
If I try to in-place-edit an element in a sub-list, the update actually occurs but the browser continues to show "Saving ..." and an "RJS TypeError: element is null" occurs. Another error message follows, "ActiveScaffold.replace_html("as_players-update_column-3-name-cell", "Alan Anderson");"
I think what is happening is that the element, name for example, in the sub-list has the id as_teams_1_players-update_column-1-name-cell
rather than as_players-update_column-1-name-cell
, so the HTML does not get updated and an error occurs.
You can demonstrate this by starting with the "Howto" demo and adding
conf.columns[:name].inplace_edit = true
to players_controller.rb and
has_many :players
to team.rb. Create a team, add a player, then try to edit the player's name in the sub-list.
Similar to this issue with some old branch of active_scaffold
http://code.google.com/p/activescaffold/issues/detail?id=527
Proposed quick fix would be just to remove the error_messages_for method in the active scaffold view helper, and include https://github.com/rails/dynamic_form as a dependency.
I am getting this error when I try to display anything with a Unicode character such as a character with an accent. Everything works fine when I use a standard template, but if I switch to an AS one, I get this error. Everything is defined as UTF-8 and I have verified that I'm getting a UTF-8 string from the DB, i.e. Country.find(16).name.encoding gives #Encoding:UTF-8.
I can display with ActiveScaffold if I make a virtual column, such as name2, where name2=name.force_encoding('utf-8') -- that does work. I can only conclude that the problem is somewhere in AS, since everything works properly without it but not with it ... of course, that is no proof!
I'm using Rails 3.0, MySQL, and mysql2 adapter.
conf.actions = [:field_search, :list, :show, :subform]
Showing /home/korobkov/work/devel/brisbane/vendor/plugins/active_scaffold/frontends/default/views/_list_header.html.erb where line #6 raised:
undefined local variable or method `nested' for #<#<Class:0x00000005239600>:0x00000005237418>
Extracted source (around line #6):
3: <div class="actions">
4: <%= render :partial => 'action_group', :locals => {:action_links => action_links,
5: :url_options => params_for,
6: :traverse_options => nested.nil? ? {} : {:reverse => true}} %>
7: <%= loading_indicator_tag(:action => :table) %>
8: </div>
9: <% end %>
With conf.actions = [:field_search, :list, :nested, :show, :subform]
it works...
May be, some checking for nested.nil? would help?
On a list view, the class names for columns are ending in a " " blank character, like this:
<td class="contacts-column ">
Is this intentional? Also, on the Show view, the <dd>
classes begin with a quote character,
<dd class=""name-view" "="">
Start with the example setup of teams and players.
Add to players_controller, "config.columns[:team].actions_for_association_links = [:show]"
[NB: The generator apparently uses |conf| instead of |config| when it sets up controllers. This can lead to a lot of frustration for new users (like me) since the documentation always refers to "config"]
Enter a player and a team. Browse .../players. Click on the team name in the list, to bring up the Show box. Now, if you click on the x icon to close the box, it works. If you click on the Close button, you get a messy error screen.
I'm adding a new custom action link to my controller. I've added a blank method and html.erb for the action link but get an error when I click the "Remove Device" link.
Here is my controller:
class CabinetPositionsController < ApplicationController
active_scaffold :cabinet_position do |conf|
label = "Positions"
action_links.add 'remove_device', :label => 'Remove Device', :crud_type => :update, :type => :member
list.sorting = {:name => 'ASC'}
columns[:device].actions_for_association_links = [:show]
end
def remove_device
end
end
First few lines I got from the trace result:
NoMethodError in Cabinet positionsController#remove_device
undefined method `merge' for nil:NilClass
Rails.root: /Users/jiangle/project/rails/dcrm
Application Trace | Framework Trace | Full Trace
activesupport (3.0.3) lib/active_support/whiny_nil.rb:48:in `method_missing'
vendor/plugins/active_scaffold/lib/extensions/action_controller_rendering.rb:9:in `render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:465:in `_run__1646989264__process_action__238293908__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `send'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:124:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `send'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.1) lib/rack/server.rb:213:in `start'
railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
railties (3.0.3) lib/rails/commands.rb:30
railties (3.0.3) lib/rails/commands.rb:27:in `tap'
railties (3.0.3) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
activesupport (3.0.3) lib/active_support/whiny_nil.rb:48:in `method_missing'
vendor/plugins/active_scaffold/lib/extensions/action_controller_rendering.rb:9:in `render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
The version of active_scaffold is commit 93ee64b. Rails 3.0.3
To create a customized sub-form for the name
column of one model, I put
def name_form_column(record,params)
... customized code ...
end
into members_helper.rb
. It works fine, but the same customized code is now being used for all the models with a name
field. Since the override is defined in one model's helper file, should it not automatically be limited to that model?
when set
config.i18n.default_locale = :de #or :ja, :es
the error still occurs as following:
TypeError (can't convert String into Hash):
this error could by fixed by remove '.merge(as_(:date_picker_options))' in line 78 and line 91 of the file "active_scaffold/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb"
67 date_picker_options = { :closeText => as_(:close),
68 :prevText => as_(:previous),
69 :nextText => as_(:next),
70 :currentText => as_(:today),
71 :monthNames => date_options[:month_names][1, (date_options[:month_names].length - 1)],
72 :monthNamesShort => date_options[:abbr_month_names][1, (date_options[:abbr_month_names].length - 1)],
73 :dayNames => date_options[:day_names],
74 :dayNamesShort => date_options[:abbr_day_names],
75 :dayNamesMin => date_options[:abbr_day_names],
76 :changeYear => true,
77 :changeMonth => true,
78 } #.merge(as_(:date_picker_options))
87 datetime_picker_options = {:ampm => false,
88 :hourText => datetime_options[:hour],
89 :minuteText => datetime_options[:minute],
90 :secondText => datetime_options[:second],
91 } #.merge(as_(:datetime_picker_options))
rails g active_scaffold_setup jquery
when set
config.i18n.default_locale = :de #or :ja, :es
TypeError in PlayersController#index
can't convert Symbol into Integer
Rails.root: /home/sdr/workspace/howto
Application Trace | Framework Trace | Full Trace
app/controllers/players_controller.rb:2:in <class:PlayersController>' app/controllers/players_controller.rb:1:in
<top (required)>'
vendor/plugins/active_scaffold/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb:71:in []' vendor/plugins/active_scaffold/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb:71:in
date_options'
vendor/plugins/active_scaffold/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb:54:in localization' vendor/plugins/active_scaffold/lib/active_scaffold/bridges/date_picker/bridge.rb:12:in
block (2 levels) in <top (required)>'
vendor/plugins/active_scaffold/lib/active_scaffold/bridges/bridge.rb:36:in call' vendor/plugins/active_scaffold/lib/active_scaffold/bridges/bridge.rb:36:in
run'
vendor/plugins/active_scaffold/lib/active_scaffold/bridges/bridge.rb:42:in block in run_all' vendor/plugins/active_scaffold/lib/active_scaffold/bridges/bridge.rb:41:in
each'
vendor/plugins/active_scaffold/lib/active_scaffold/bridges/bridge.rb:41:in run_all' vendor/plugins/active_scaffold/lib/active_scaffold.rb:59:in
active_scaffold'
activesupport (3.0.1) lib/active_support/dependencies.rb:454:in load' activesupport (3.0.1) lib/active_support/dependencies.rb:454:in
block in load_file'
activesupport (3.0.1) lib/active_support/dependencies.rb:591:in new_constants_in' activesupport (3.0.1) lib/active_support/dependencies.rb:453:in
load_file'
activesupport (3.0.1) lib/active_support/dependencies.rb:340:in require_or_load' activesupport (3.0.1) lib/active_support/dependencies.rb:491:in
load_missing_constant'
activesupport (3.0.1) lib/active_support/dependencies.rb:183:in block in const_missing' activesupport (3.0.1) lib/active_support/dependencies.rb:181:in
each'
activesupport (3.0.1) lib/active_support/dependencies.rb:181:in const_missing' activesupport (3.0.1) lib/active_support/inflector/methods.rb:124:in
block in constantize'
activesupport (3.0.1) lib/active_support/inflector/methods.rb:123:in each' activesupport (3.0.1) lib/active_support/inflector/methods.rb:123:in
constantize'
activesupport (3.0.1) lib/active_support/dependencies.rb:523:in block in <class:Reference>' activesupport (3.0.1) lib/active_support/dependencies.rb:533:in
yield'
activesupport (3.0.1) lib/active_support/dependencies.rb:533:in default' activesupport (3.0.1) lib/active_support/dependencies.rb:533:in
get'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:58:in controller_reference' actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:44:in
controller'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:23:in call' rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in
block in call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in block in recognize' rack-mount (0.6.13) lib/rack/mount/code_generation.rb:117:in
optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in recognize' rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in
call'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:492:in call' actionpack (3.0.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in
call'
actionpack (3.0.1) lib/action_dispatch/middleware/head.rb:14:in call' rack (1.2.1) lib/rack/methodoverride.rb:24:in
call'
actionpack (3.0.1) lib/action_dispatch/middleware/params_parser.rb:21:in call' actionpack (3.0.1) lib/action_dispatch/middleware/flash.rb:182:in
call'
actionpack (3.0.1) lib/action_dispatch/middleware/session/abstract_store.rb:149:in call' actionpack (3.0.1) lib/action_dispatch/middleware/cookies.rb:287:in
call'
activerecord (3.0.1) lib/active_record/query_cache.rb:32:in block in call' activerecord (3.0.1) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in
cache'
activerecord (3.0.1) lib/active_record/query_cache.rb:12:in cache' activerecord (3.0.1) lib/active_record/query_cache.rb:31:in
call'
activerecord (3.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in call' actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:46:in
block in call'
activesupport (3.0.1) lib/active_support/callbacks.rb:415:in _run_call_callbacks' actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:44:in
call'
rack (1.2.1) lib/rack/sendfile.rb:107:in call' actionpack (3.0.1) lib/action_dispatch/middleware/remote_ip.rb:48:in
call'
actionpack (3.0.1) lib/action_dispatch/middleware/show_exceptions.rb:46:in call' railties (3.0.1) lib/rails/rack/logger.rb:13:in
call'
rack (1.2.1) lib/rack/runtime.rb:17:in call' activesupport (3.0.1) lib/active_support/cache/strategy/local_cache.rb:72:in
call'
rack (1.2.1) lib/rack/lock.rb:11:in block in call' <internal:prelude>:10:in
synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in call' actionpack (3.0.1) lib/action_dispatch/middleware/static.rb:30:in
call'
railties (3.0.1) lib/rails/application.rb:168:in call' railties (3.0.1) lib/rails/application.rb:77:in
method_missing'
railties (3.0.1) lib/rails/rack/log_tailer.rb:14:in call' rack (1.2.1) lib/rack/content_length.rb:13:in
call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in service' /home/sdr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
service'
/home/sdr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:70:in run' /home/sdr/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in
block in start_thread'
I added :field_search to a controller and it works fine except that clicking "Reset" either in the search menu or in the resulting list leads to a "500" error. The server output shows:
Started GET "/members?utf8=%E2%9C%93&search=" for
Processing by MembersController#index as JS
Parameters: {"utf8"=>"G£ô", "search"=>""}
NoMethodError (undefined method `each' for "":String):
(Sometimes the utf8 part is not there). This happens with or without the human_conditions added (which is a really nice feature!).
Issue 33 is closed but I have made another comment on it ... not sure if it should go there or in a new issue here so I'll copy the comment here:
Still not working well. The problem is that the ActiveScaffold controllers (at least, the delete action that I'm working with) do not use the error messages from the record:
def do_destroy
destroy_find_record
begin
self.successful = @record.destroy
rescue
flash[:warning] = as_(:cant_destroy_record, :record => @record.to_label)
self.successful = false
end
end
What I am trying to do is to prevent deletion of certain records, using before_destroy:
. I am doing the error checking in the model therefore, not the controller, and I don't think I have access to flash there. A previous post said to use
errors.add(<attribute>, <message>)
in a similar situation so that is what I have done, but it's not picked up by do_destroy. Furthermore, do_destroy only outputs the error message if an exception is raised, so my member before destroy
method needs to add the error message, then raise an exception.
I've added an override do_destroy
method
def do_destroy
@record = find_if_allowed(params[:id], :delete)
begin
self.successful = @record.destroy
rescue
flash[:warning] = as_(:cant_destroy_record, :record => @record.to_label)
flash[:warning] << " because #{@record.errors[:delete]}"
self.successful = false
end
end
but it would be nice if I could simply add error messages to the model and have them displayed automatically.
I've AS installed over a devise-cancan environment.
When I try to add a new user, it is created correctly, but this error is shown.
I think is something related to devise (that add user through registration form), but I don't know how to solve it without modify the AS core.
Can you help me?
If you need more information, just tell me.
Hi, I have successfully installed the plugin and it works fine. But then I noticed that in the demo (http://demo.activescaffold.com/users) almost everything work with ajax (creating new item, sorting and so on) and in my project each action reloads the page.
First I had javascript error in rails.js "document.on is not a function" and I have fixed that by wrapping the code with
document.observe("dom:loaded", function() {
// --- all functions with document.on
})
and the error was gone but it didn't solve my problem with ajax.
So my environment:
windows xp (ubuntu 10.04 has the same problem)
rails 3.0.1
ruby 1.8.7
mozilla firefox, chrome
I have triple checked that all javascript are included, no javascirpt errors and some problems with blocking javascript, nothing like that.
I have also noticed that in the demo in the titles all links have onclick function and in my project -no. But it has attributes "data-remote='true'" and that is why I think it should be with ajax.
Thanks
For using javascript it would sometimes be useful to know when a new subform has opened or closed. Are there callbacks available for those events?
I've used config.show.link.inline = false
for a link but it is not opening up the link when clicked. It works when "open in new tab" is selected in the browser. I think this is because the link tag still has data-remote="true"
in it.
Search and general display seems to work on a clean install and configuration, but on clicking new (using jQuery configuration), I get the following error:
undefined method `errors' for :record:Symbol
Extracted source (around line #4):
1: <%= render :partial => 'messages' %>
2:
3: <% unless @record.nil? %>
4: <%= error_messages_for :record, :object_name => @record.class.model_name.human.downcase %>
5: <% end %>
Trace of template inclusion: vendor/plugins/active_scaffold/frontends/default/views/_base_form.html.erb, vendor/plugins/active_scaffold/frontends/default/views/_create_form.html.erb, vendor/plugins/active_scaffold/frontends/default/views/create.html.erb
seems that when you do the standard described on the as wiki using :record and :field name, it breaks when the models are used in subforms. this is what I have found to work best retaining label associations,
text_area options[:name].gsub("[answer]", ""), :answer, :rows => 2, :cols => 50, :value => record.answer
but there must be a better way? this seems like a hack and shouldn't work like this.
EDIT: ok it does not preserve label associations, those get broken as well.
I am trying to update a field based on a field that was changed and another field. Since AS usually only send the value of the changed column, I need other values to render the updated columns, and therefore need to enable send_form_on_update_column so that all the form will be sent. It does not seem that this feature has made the cut. Can this be implemented?
See: https://github.com/activescaffold/active_scaffold/wiki/Chaining-Form-Fields
Symbol as array index is raised in ActiveScaffold::DataStructures::Sorting#set_default_sorting, line 13
I am trying to add security methods so I declared:
def authorized_for_delete?
end
in my model but it was never called.
ActiveRecordPermissions::Permissions::SecurityMethods should be included in ActiveRecord but it seems it is included the wrong way as all the methods are applied to the Class. So the function could be called only as singleton self. authorized_for_delete? which is not the desired functionality.
I forked your fork :) and I am giving a look. If you have any hints it would be great to share. Thank for this fork and all additions to AS!
The install method for this bridge attempts to do file I/O (cp/rm) and this has two problems:
The test it's doing to decide whether or not the JS file should exist sometimes seems to produce different results. I.E. sometimes it will try to remove the file, sometimes it will try to add it -- even though we have js_framework set to :jquery per the setup instructions. Order-of-operations inconsistency perhaps?
Copying files around should be done via the active_scaffold_setup generator -- if the concern is to facilitate testing changes to the relevant files, then perhaps the I/O ops should be constrained to dev mode, not test/production (as these may be executed on systems like Heroku where one does not have a writeable FS).
Line 625 of jquery version of "active_scaffold/frontends/default/javascripts/jquery/active_scaffold.js" tryes to use "$(options.id)" to see if a DOM object already exists, but the syntax is not updated fot jquery.
Fix:
vi active_scaffold/frontends/default/javascripts/jquery/active_scaffold.js +625
Hi,
I followed your steps on http://vhochstein.wordpress.com/2010/08/28/setup-activescaffold-rails-3/ to create a howto rails 3 project. The javascript framework I choose is jquery when setup active_scaffold. Everything works but the nested link of players. I’ve created a team with 3 players. But when I click the players nested link the players list doesn’t not always appear.
I tried quite a few times. This is quite strange. And if I click nested players link after click edit and then cancel it, the players list always appears.
activescaffold is the latest commit on Nov 26th
MacOS 10.6.5
Rails 3.0.3
ruby 1.8.7 (2009-06-12 patchlevel 174)
Firefox 3.6.12
After submitting an in place AJAX form consisting of a collection of checkboxes (plural association) I get the following error:
NoMethodError (private method
select' called for "2":String)`
It seems that instead of array it submits only the value of the first checkbox.
Example models and controllers:
class Post < ActiveRecord::Base
has_and_belongs_to_many :categories
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :posts
end
class PostsController < ApplicationController
active_scaffold :post do |conf|
columns[:categories].inplace_edit = :ajax
end
end
class CategoriesController < ApplicationController
active_scaffold :category do |conf|
end
end
I'm using Rails 3.0.3 with jQuery, Ruby 1.9.3 on Linux
Thanks
Hi folks
i have 3 simple models
class Region < ActiveRecord::Base
has_many :cities
has_many :schools, :through => :cities
end
class City < ActiveRecord::Base
belongs_to :region
has_many :schools
end
class School < ActiveRecord::Base
belongs_to :city
end
Hi, for activescaffold I'm using controllers with the prefix "as", so I added next to my ApplicationController:
protected
def self.active_scaffold_controller_for(klass)
return UserManagementController if klass == User
return AsProfilesController if klass == Profile
return "#{klass}ScaffoldController".constantize rescue super
end
And it worked,
Here is my profile controller
class AsProfilesController < AdministratorsController
before_filter :require_admin
active_scaffold :profile do |config|
config.columns.exclude :objective
config.columns << :user
config.columns[:user].label = "Coach"
config.columns.exclude :id
end
end
And user_management controller
class UserManagementController < AdministratorsController
before_filter :require_admin
active_scaffold :user do |config|
config.columns = [:email, :first_name, :last_name, :title, :roles, :enterprise, :deleted_at, :profile]
config.create.columns.exclude :id
config.update.columns.exclude :id
end
end
So when I open users page I have column with profiles
Starting from here I have all my problems
And I have often noticed that updating a model through association doesn't initiate updating info on the screen, only after completaly page reload.
I'm not sure if this is due to controller names, I have no exceptions and I didn't change something inside of the plugin but I'm have all those problems with updating data using associations.
Please help :)
line 4 in 'active_scaffold/lib/extensions/localize.rb'
text = I18n.translate "#{key}", {:scope => [:active_scaffold], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
should be
text = I18n.translate! "#{key}", {:scope => [:active_scaffold], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
I'm trying to get the auto_complete plugin to work with a Rails 3/ActiveScaffold project, but haven't had any success yet. I'm not sure whether I'm doing something wrong or if it's not supported in this fork. If it's supported, is there an example somewhere? Thanks.
Im tryng to set it up but getting this error: c:/Ruby187/lib/ruby/1.8/net/http.rb:586:in `connect': SSL_connect returned=1 err
no=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::
SSL::SSLError)
any ideas why?
Running "rake test" on the sample teams-players setup fails in the functional tests. One problem is that the create and update tests use "post :create, :player => @player.attributes" (same for :update), while the controller seems to be expecting "post :create, :record => @player.attributes". I haven't traced the other error, where test_should_get_index gets a nil object.
Are there any guidelines, examples, or discussion of how to develop good functional tests for ActiveScaffold controllers?
Hi,
I tried using active_scaffold with rails 3 and ruby 1.9.2 but I get this error when I try to start the server:
/Users/john/.rvm/gems/ruby-1.9.2-p0/gems/active_scaffold-3.0.2/lib/active_scaffold/helpers/controller_helpers.rb:8:in `module:ControllerHelpers': uninitialized constant ActiveScaffold::Helpers::IdHelpers (NameError)
i have a companies controller using active active scaffold.On clicking the search link the search box in the list view is opening in a different page.i jst cnt understand what's causing this problem.Is this a routing problem?I have used as_routes in my routes.rb file,and using rails 3.0.0 and ruby 1.8.7.I am new to rails,and i am badly stuck in this section.plz hlp.
Hi, I have rails3, jQuery and activescaffold and it worked fine while I had simpel models.
To simplify the problem I will operate only two models: User and Enterprise
So User belongs_to Enterprise
Enterprise has_many users
validateion inside of a user: validates :enterprise, :presence => true
So when I try to create new user I see the drop down with existing enterprises and able to add new one. So I select existing one and click "Create" and see validation error message "enterprise can't be blank"
Firebug shows that it passes associated_id to server (not sure what does it mean but the value is the id of enterprise)
So I have not javascirpt errors, no exceptions it just doesn't see selected enterprise on the server.
The same problem with the roles (User has_many: rolse)
I think maybe there is something that I missed because Enterprise has_many users and it works fine but cannot figure out the issue by myself.
Please help
I'm using the current head from git (along with the forked render_component etc)
Active scaffold is working when I load a stand alone controller, but whenever I try to render it from a view, eg:
<%= render :active_scaffold => 'admin/agent' -%>
I get the following error:
ActionView::Template::Error (undefined method `formats' for nil:NilClass):
1: = render :active_scaffold => 'admin/agent'
app/views/test/index.haml:1:in _app_views_test_index_haml__226741202_88287490_654131706'
I'm not sure if this is a bug in the fork or with Rails 3, but this was working previously on Rails 2.3 and the current main active scaffold branch.
For some reason, rails isn't giving a decent stack trace of where in active scaffold the error is occurring, so let me know if there
any other information I could provide to help track the cause of this down.
Cheers
Dave Smylie
/home/korobkov/work/devel/perth/app/controllers/book_descriptions_controller.rb:34: invalid multibyte char (US-ASCII)
/home/korobkov/work/devel/perth/app/controllers/book_descriptions_controller.rb:34: invalid multibyte char (US-ASCII)
/home/korobkov/work/devel/perth/app/controllers/book_descriptions_controller.rb:34: syntax error, unexpected $end, expecting ')'
...create.columns.add_subgroup("а�аГаЛаАаВаЛаЕаНаИаЕ аИ б�аКаАа...
Setting # encoding: utf-8
at the first line of file does help, but the strange thing is without this line UTF-8 is rejected only in subgroup! When I set conf.label = "some non-ASCII chars"
it works even without this line!
config.encoding = "utf-8"
is set in application.rb.
ruby 1.9.2, rails 3.0.3, AS - the latest commit from git master branch.
Thanks for the plugin.
I've used it before for rails 2.3 and configured nested links like this:
as.columns[:some_column].set_link(:nested, :parameters => {:associations => :some_association})
All was fine until I've switched to Rails 3 fork. Now it reports error message about missing :nested route. I think, it's related to moving tovards pure REST (with nested resources routes instead of :nested action).
The question is what should I write now to have the same effect (yes, I've read your blog about setting nested links, but that was about standalone links in the actionlinks section of page; now I am speaking about nested link, attached to column)?
If some helper in AS could generate right code for standalone link, I guess that should be somewhere a piece of code to do the same thing for column link... How should I call it?
It would be nice to get rid of this warning since when running cucumber scenarios, the screen is full of these. I would fix this myself if I just knew how to do it...
DEPRECATION WARNING: save(false) is deprecated, please give save(:validate => false) instead. (called from save at /.../vendor/plugins/active_scaffold/lib/extensions/unsaved_record.rb:15)
Given these models:
class User < ActiveRecord::Base
belongs_to :group
end
class UserGroup < ActiveRecord::Base
has_many :users, :dependent => :destroy
end
and these controllers:
class UserGroupsController < ApplicationController
active_scaffold :user_group
end
class UsersController < ApplicationController
active_scaffold :user
end
In the User subform within the create/edit pages for UserGroups, the "create another" button does nothing. No warnings, no javascript errors, no application errors. Any ideas?
I tried to use a radio button in form_ui but it will display the html characters. I tried to locate the line where the form is rendered and use <%= raw %> but did not have much luck.
Is the file _horizontal_subform_record.html.erb the correct one?
Perhaps I don't understand the nested.add_link feature. I have, for example,
class Member < ActiveRecord::Base
belongs_to :bloodtype
...
class Bloodtype < ActiveRecord::Base
has_many :members
...
and I am trying to have a nested link to members in the list of bloodtypes, so it would look like, for example, "| Type O+ | Members Edit Delete Show |
Putting config.nested.add_link('Members',[:members])
into bloodtypes.controller does not seem do do anything. I can simply show the Members column within the list and by default it provides the same functionality of opening a nested list when clicked, but I can't seem to create that link in the actions with add_link.
Line 30 of "active_scaffold/frontends/default/views/_form_association_footer.html.erb" hardcodes prototype's "Ajax" and renders an error when used with jquery
Fix:
vi active_scaffold/frontends/default/views/_form_association_footer.html.erb +30
REMOVE THIS LINE - (30)
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "new Ajax.Request(#{edit_associated_url.to_json}.sub('--ID--', id), {asynchronous: true, evalScripts: true, onFailure: function(){ActiveScaffold.report_500_response(#{active_scaffold_id.to_json})}});" -%>
AND ADD THIS + http://pastie.org/1220735
<%
if ActiveScaffold.js_framework == :prototype
onselect = <<DOC
new Ajax.Request(
#{edit_associated_url.to_json}.sub('--ID--', id), {
asynchronous: true,
evalScripts: true,
onFailure: function(){
ActiveScaffold.report_500_response(#{active_scaffold_id.to_json})
}
}
);
DOC
elsif ActiveScaffold.js_framework == :jquery
onselect = <<DOC
$.ajax({
url: #{edit_associated_url.to_json}.split('--ID--').join(id),
error: function(xhr, textStatus, errorThrown){
ActiveScaffold.report_500_response(#{active_scaffold_id.to_json})
}
});
DOC
end
onselect = onselect.gsub(/\n/, ' ')
%>
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => onselect -%>
Given this setup based on "howto"
class Player < ActiveRecord::Base
belongs_to :team
end
class Team < ActiveRecord::Base
has_many :players
end
class TeamsController < ApplicationController
active_scaffold :team do |config|
list.columns = [:name, :players, :position]
end
end
class PlayersController < ApplicationController
active_scaffold :player do |config|
list.columns = [:name, :team]
config.columns[:team].actions_for_association_links = [:list]
end
end
The list of players now includes team for each player. If you click on the team, a nested list view opens for the team.
The strange behaviour is that the nested list draws its title from the wrong source, the id of the team. For example, given this scenario:
| Team | ID |
| Lions | 1 |
| Bears | 2 |
| Player | ID | Team (ID) |
| Dilbert | 1 | Lions (1) |
| Snarkle | 2 | Lions (1) |
| Driscol | 3 | Bears (2) |
Click on Lions in the line for Snarkle, player 2, and the nested list will be labeled "Team for Dilbert". Click on Bears for Driscol, and the label will be "Team for Snarkle". The name in the label is being formed from the id
of the team (e.g. 1 for the Lions) when it should be using the player's id
.
Besides the wrong label, the nested view will fail to open at all if there is not a player with the same id as the team being opened. In my test it doesn't crash or give an error message, nothing happens, but it's probably because of a failed lookup for the player.
I think the problem may have other affects as well, since what I'm trying to do works when a list is primary but not when it's nested, but I can't be sure about that.
How does one send custom error messages like the "error 500" or "object cannot be deleted" in ActiveScaffold? I've tried using flash.now[:error] but it doesn't seem to do anything. Is there a way to tap into the very same function that currently displays the errors?
I get this message during testing when the program sends the message "1 error prohibited this from being saved." I traced it to lines 100 and 101 of plugins\active_scaffold\lib\active_scaffold\locale\en.rb where {{key}} is still being used. It is also in the de.rb and fr.rb files. I would fix such an easy error myself but haven't yet learned how to check out and commit gits :-( .
is there something I need to add to routes like as_routes to get this to work?
vi active_scaffold/frontends/default/views/add_existing.js.rjs +2
Replace line 2
I don't know whether this is a bug or I'm doing something wrong but ... it seems that if a fixture value is a number (an integer, at least), then the functional test on create and update have errors. Line 134 of attribute_params.rb appears to assume that value is a string, since it says "value.gsub....". I placed a value=value.to_s before that line, but I don't know if that's taking care of everything or just hiding a problem. Why does this work in the development environment but not in testing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.