Sorry, that was my bad when pasting the code. I was trying out
different stuffs before replying. I did have ":controller => 'show'"
Does it have to do with how I do association in the model?

It shows fine without trying to put links on the rows.


On Jul 6, 11:25 am, redbros <[email protected]> wrote:
> Here's my controller code. :product is my model:
>
> class StoreController < ApplicationController
>
>   active_scaffold :product do |config|
>     config.columns =
> [:code, :name, :make, :model, :year, :equipment_type, :price]
>     config.actions.exclude :create, :delete, :show, :update
>     config.columns[:name].set_link 'show', controller => 'store'
>   end
>
>   @sort_type = ''
>   @max_per_page = 50
>   @tag_names = nil
>
>   # Our simple store index
>   def index
>     @title = "Store"
>                 @tags = Tag.find_alpha
>                 @tag_names = nil
>                 @viewing_tags = nil
>
>     @products = Product.paginate(
>       :order => 'name ASC',
>       :conditions => Product::CONDITIONS_AVAILABLE,
>       :page => params[:page],
>       :per_page => @max_per_page
>     )
>   end
>
>   def search
>     @search_term = params[:search_term]
>     @title = "Search Results for: #...@search_term}"
>     @products = Product.paginate(
>       :order => 'name ASC',
>       :conditions => ["(name LIKE ? OR code = ? OR model LIKE ?) AND #
> {Product::CONDITIONS_AVAILABLE}", "%...@search_term}%", @search_term,
> @search_term],
>       :page => params[:page],
>       :per_page => @max_per_page
>     )
>     # If only one product comes back, take em directly to it.
>     if @products.size == 1
>       redirect_to :action => 'show', :id => @products[0].code and
> return
>     else
>       render :action => 'index'
>     end
>   end
>
> def show
>     @product = Product.find_by_code(params[:id])
>     if !...@product
>       flash[:notice] = "Sorry, we couldn't find the product you were
> looking for"
>       redirect_to :action => 'index' and return false
>     end
>     @title = @product.name
>     @images = @product.images.find(:all)
>     @default_image = @images[0]
>     @variations = @product.variations.find(
>       :all,
>       :order => 'name ASC',
>       :conditions => 'quantity > 0'
>     )
>   end
>
> end
>
> On Jul 6, 11:15 am, Kenny Ortmann <[email protected]> wrote:
>
> > Would you paste your controllers code as well please?
>
> > On Mon, Jul 6, 2009 at 11:12 AM, redbros <[email protected]> wrote:
>
> > > Thanks Sergio for jumping in.
>
> > > I did use "set_link" like you indicated but got error while rendering
> > > the page. Any ideas?
>
> > >  Showing vendor/plugins/active_scaffold/frontends/default/views/
> > > _list_record.rhtml where line #14 raised:
>
> > > You have a nil object when you didn't expect it!
> > > The error occurred while evaluating nil.name
>
> > > Extracted source (around line #14):
>
> > > 11:     <% column_value = get_column_value(record, column) -%>
> > > 12:
> > > 13:     <td class="<%= column_class(column, column_value) %>" >
> > > 14:       <%= render_list_column(column_value, column, record) %>
> > > 15:     </td>
> > > 16:   <% end -%>
> > > 17:   <% if active_scaffold_config.action_links.any? {|link| link.type
> > > == :record } -%>
>
> > > Trace of template inclusion: /vendor/plugins/active_scaffold/frontends/
> > > default/views/_list.rhtml, /vendor/plugins/active_scaffold/frontends/
> > > default/views/list.rhtml
>
> > > vendor/plugins/active_scaffold/lib/active_scaffold/helpers/
> > > list_column_helpers.rb:69:in `render_list_column'
> > > vendor/plugins/active_scaffold/frontends/default/views/
> > > _list_record.rhtml:14:in
>
> > > `_run_erb_47vendor47plugins47active_scaffold47frontends47default47views47_list_record46rhtml'
> > > vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/
> > > action_columns.rb:69:in `each'
> > > vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/
> > > action_columns.rb:56:in `each'
> > > ......
>
> > > On Jul 6, 10:35 am, "Sergio Cambra .:: entreCables S.L. ::."
> > > <[email protected]> wrote:
> > > > On Lunes, 6 de Julio de 2009 08:16:08 redbros escribió:
>
> > > > > Hi,
>
> > > > > I'm new to ActiveScaffold. Just got it setup and trying to customize
> > > > > it now. I need some help with the usage of the Action Link. I want to
> > > > > add a link to a column for each of my record. According to this
> > > > >http://activescaffold.com/docs/api-action-linkIcoulddo that by
>
> > > > > config.columns[:name].link
>
> > > > To set a link in a column:
> > > > config.columns[:name].set_link 'action_name', :controller =>
> > > 'controller_name'
> > > > You can add more options, look at api: action linkhttp://
> > > wiki.github.com/activescaffold/active_scaffold/api-action-link
>
> > > > To add a link at right (next to edit, delete and show links):
> > > > config.action_links.add 'action_name', :type => 'record', ...
>
> > > > > Doesn't seem to create a link on the table in each row. Also, how do I
> > > > > add restful feature to the link (e.g.: Need to
> > > > > add :action, :controller, :id
>
> > > > > I'm on ActiveScaffold version for rails 2.1
>
> > > > > Any help is very much appreciated!!!
>
> > > > > -Dave
>
> > > > --
> > > > 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