It works if I copy the template file to my app and change record.id to
record.to_param there.

Thanks.

On Jul 3, 9:24 pm, atmorell <[email protected]> wrote:
> Hi,
>
> I don't need permalink_fu anymore, as the plugin you suggested has a
> slug function. Blog.to_params returns "some-title" and I can do /blogs/
> some-title. I can't get AS to use the to_param in my model.
>
> class Blog < ActiveRecord::Base
>   has_friendly_id :title, :use_slug => true
>
>   def to_param #Get's ignored
>     self.to_param
>   end
>
> end
>
> Any ideas? I guess it would be possible to find the method that
> generates the url and change .id to to_params - then everything breaks
> next time I update my plugins :/
>
> Best regards.
> Asbjørn Morell
>
> On Jul 2, 9:30 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> <[email protected]> wrote:
> > On Miércoles, 1 de Julio de 2009 20:04:45 atmorell escribió:
>
> > > Hey,
>
> > > Almost got it working:
>
> > > Controller
> > >     config.show.link = false
> > >     config.columns = [:photo, :title, :content, :created_at, :show]
> > >     config.columns[:show].label = " "
>
> > > This gives me a Show link as virtual column, that can be customized
> > > further in the helper.
>
> > >   def show_column(record)
> > >      link_to(h("Show"), :action => :show, :controller =>
> > > 'paintings', :id => record.permalink)
> > >   end
>
> > > Now I got a show link with a pretty url: /paintings/some-sef-of-the-
> > > title Only problem is that the link is in a show-column div and not in
> > > the actions div. How do I configure the link to be displayed in the
> > > actions div? Is this the correct way of doing something like this? I
> > > have been reading, so much in the github wiki, forum etc but might
> > > have completely missed something
>
> > Action links in the actions div get the id filled in 
> > _list_actions.html.erb. As
> > you can see ActiveScaffold set the id as record.id instead of 
> > record.to_param.
> > Maybe there are more places with record.id instead of record.to_param
>
> > Only changing record.id with record.to_param it should work with
> > has_friendly_id plugin.
>
> > For permalink_fu plugin, you should add to_param to each class which has
> > permalink.
> >         def to_param
> >               permalink
> >         end        
>
> > And you will have to override find_if_allowed:
> >     def find_if_allowed(id, action, klass = nil)
> >       klass ||= active_scaffold_config.model
> >       record = if id =~ /[A-Za-z]/
> >         klass.find_by_permalink(id)
> >       else
> >         klass.find(id)
> >       end
> >       raise ActiveScaffold::RecordNotAllowed unless record.authorized_for?
> > (:action => action.to_sym)
> >       return record
> >     end
>
> > I think it should work with these changes.
>
> > > Best regards.
> > > Asbjørn Morell.
>
> > > On Jul 1, 9:57 am, atmorell <[email protected]> wrote:
> > > > I need to change the action for the show link e.g /blogs/some-text-
> > > > from-my-permalink-column instead for /blogs/1 How do override the
> > > > action for a crud like that?
>
> > > > On 1 Jul., 03:23, [email protected] wrote:
> > > > > Do you just want to change the display?
>
> > > > > config.show.link.label = "whatever"
>
> > > > > Look at the action link documentation on the github wiki
> > > > > Sent from my Verizon Wireless BlackBerry
>
> > > > > -----Original Message-----
> > > > > From: atmorell <[email protected]>
>
> > > > > Date: Tue, 30 Jun 2009 18:21:09
> > > > > To: ActiveScaffold : Ruby on Rails
> > > > > plugin<[email protected]> Subject: Re: Pretty urls when
> > > > > showing a record.
>
> > > > > Thanks - Works great. Hmmm how do I override the show link? I can only
> > > > > override a table column name title etc with the permalink.
> > > > > show_column in the helper get's ignored :/ Do I need to disable the
> > > > > show link and create a new custom show link? Could you post a example?
>
> > > > > On Jun 30, 10:11 pm, [email protected] wrote:
> > > > > > You can just override the method you need to in the controller. If
> > > > > > you alias a name to go to the show action just override the show
> > > > > > action. Sent from my Verizon Wireless BlackBerry
>
> > > > > > -----Original Message-----
> > > > > > From: atmorell <[email protected]>
>
> > > > > > Date: Tue, 30 Jun 2009 07:25:08
> > > > > > To: ActiveScaffold : Ruby on Rails
> > > > > > plugin<[email protected]> Subject: Pretty urls when
> > > > > > showing a record.
>
> > > > > > Hello,
>
> > > > > > How do I override the find method for a single AS controlelr action?
> > > > > > I would like to use find_by_permalink on my show method.
>
> > > > > > Trying to add pretty urls to my blog like so:
> > > > > > title: this is my first log -> blogs/this-is-my-first-blog
>
> > > > > > So I thougt about using permalink_fu - it will generate a pretty
> > > > > > alias/ url and store it in a column in the database.
>
> > > > > > Hope I am on the right track.
> > > > > > Best regards.
> > > > > > Asbjørn Morell.
>
> > --
> > Sergio Cambra .:: entreCables S.L. ::.
> > Mariana Pineda 23, 50.018 Zaragoza
> > T) 902 021 404 F) 976 52 98 07 E) [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to