Soren,

please consider this scenario :

class Thing < ActiveRecord::Base
  has_many :comments, :as => :commentable
end

class Comment < ActiveRecord::Base
  belongs_to :commentable
end

ActionController::Routing::Routes.draw do |map|
 map.resources :things, :active_scaffold => true do |thing|
    thing.resources :comments, :shallow => true, :active_scaffold => true
 end
end

in the list view for things, I want to have a link on each thing that is
labeled "New Comment" and points to things/1/comments/new

I hope this is really simple and I'm just not seeing it. Thanks for your
help :)

-C
On Tue, Nov 10, 2009 at 8:32 PM, Soren Christensen <[email protected]>wrote:

>
> Chris,
>
> Is this not the action_links as described in the documentation ?
>
> You can insert them both on a per-record basis or on a per-table basis.
>
> You can however not control the ID that is passed to the code in the
> action_link when used on a per-record basis. I fought this one for a
> while until I realized that you just have a small piece of code in the
> function called by the action link that translate the ID to whatever it
> needs to be - (DUH!). Sounds simple here - just did not occur to me that
> day.
>
> Let me know if you want examples for the action_link. Also check the
> wiki on GitHub.
>
> /S
>
> On 11/10/2009 12:39 PM, Chris Drappier wrote:
> > I have the need to create a link that doesn't appear to fit in with
> > the link customizability described in the documentation, this link
> > will be for each record, should be inside the actions column, and use
> > attributes of the record to create the link.  i need something that
> > works like the column helpers, where if you have a column foo on your
> > model, you can create a method in a helper called def
> > foo_column(record) to customize what is inside this column. it does
> > not appear that action links work the same way. is this true? is there
> > any way i can emulate this functionality for links?
>
> --
>
> 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].
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=.
>
>
>

--

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].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=.


Reply via email to