Skip to content

julienxaop/active_scaffold_hacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#########################Instalation#########################
Install this plugin to your rails application via the rails command:
script/plugin install git://github.com/julienxaop/active_scaffold_hacks.git
-------------------------------------------------------------

############################
Nested ActiveScaffold links:
############################

This plugin hack the 'condition_from_association_constraint' method initialy defined in active_scaffold/lib/active_scaffold/constraints.rb

The ActiveScaffold neested links only worked in one direction for the 'has_many-belongs_to' and 'has_one-belongs_to' relations.

This hack now solve the problem.

Take a look at the active_scaffold_hacks/lib/active_scaffold/constraints.rb file for more informations.
commit => http://github.com/julienxaop/active_scaffold_hacks/commit/b128c0635fa1ef7361bf01067e0bfadd0c7ffa27 

-----
There is also a hack that fix the polymorphic nested relations that ActiveScafold didn't handle correctly.
This issue is fixed in active_scaffold_hacks/lib/extensions/reverse_associations.rb
and in active_scaffold_hacks/frontends/default/views/_nested.html.erb
commit => http://github.com/julienxaop/active_scaffold_hacks/commit/2211beb774ec64878112ea1f5c431d36b7098ed9


-----
There is also a hack that fix the looped nested relation (when a same model have both the :has_many and :belongs_to relations).
ActiveScaffold didn't handle this case.
This issue is fixed in active_scaffold_hacks/lib/extensions/reverse_associations.rb at the end of the 'reverse_matches_for' method.
commit => http://github.com/julienxaop/active_scaffold_hacks/commit/4ed532db3835e7c15d78e9fb841f364f300bc6d3


##########################
ActiveScaffold ActionLink
##########################

The ActiveScaffold default action links (:show, :edit, :delete...) apparently can't be removed without removing the action itself. 
Example: If you want to remove the "Edit" link, you have to do: config.actions.exclude :update. 
This will remove the link but you'll then not be able to update a row anymore (The inplace-edit columns will not be updatable anymore).

I found it very strange that there was no way to just hide an action link without disableing the action itself. Maybe there is a way and I missed it. (If you know a way to do that, don't hesitate to let me know).

Anyway, I've add a :hidden attribute accessor to the ActionLink class so know you can do:
config.update.link.hidden = true
in your controllers if you want to hide the "Edit" link (Or any any other action link: 'Show', 'Delete',... even if I don't see the utility to hide these links instead of just excluding their action)

commit => http://github.com/julienxaop/active_scaffold_hacks/commit/8fc24ed41af1df390c8d08645468119337236aec

About

Some hacks of ActiveScaffold

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages