I tried changing line 70 in "list_column_helpers.rb" to

authorized = associated.authorized_for?(:action => link.crud_type) if
associated

So that it doesn't error out if "associated" is nil.
Now it works! But, my link doesn't seem to be "clickable" - i viewed
the page source and saw that it rendered a "disabled" link?

I must be missing something, but looks like I'm getting closer. If you
see anything I don't, please let me know :)

Thanks!
Dave

On Jul 6, 3:52 pm, redbros <[email protected]> wrote:
> I fixed the "script/server" start problem. Just downloaded the source
> using git instead of the plugin install.
>
> Now, back to the original problem. It still errors out, but now in a
> different line in the "list_column_helpers.rb"
>
>  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.authorized_for?
>
> 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
>
> RAILS_ROOT: /Users/David/Project/Development/RailsDev/svn/pttrading
> Application Trace | Framework Trace | Full Trace
>
> vendor/plugins/active_scaffold/lib/active_scaffold/helpers/
> list_column_helpers.rb:70: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'
>
> On Jul 6, 3:29 pm, redbros <[email protected]> wrote:
>
> > I re-installed my active scaffold but got this while trying to start
> > the web server. I got this before too, but I forgot what I had to do
> > to get it to work. I re-installed with
>
> > ./script/plugin install git://github.com/activescaffold/active_scaffold.git
> > -r rails-2.1
>
> > It looks like it's not downloading the right code branch?
>
> > => Booting Mongrel (use 'script/server webrick' to force WEBrick)
> > => Rails 2.1.0 application starting onhttp://0.0.0.0:3000
> > => Call with -d to detach
> > => Ctrl-C to shutdown server
> > ** Starting Mongrel listening at 0.0.0.0:3000
> > ** Starting Rails with development environment...
> > Exiting
> > /Users/David/Project/Development/RailsDev/svn/pttrading/vendor/plugins/
> > active_scaffold/init.rb:5:in `evaluate_init_rb': This version of
> > ActiveScaffold requires Rails 2.3 or higher.  Please use an earlier
> > version. (RuntimeError)
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin.rb:95:in `evaluate_init_rb'
> >         from /Users/David/Project/Development/RailsDev/svn/pttrading/
> > vendor/rails/activesupport/lib/active_support/core_ext/kernel/
> > reporting.rb:11:in `silence_warnings'
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin.rb:91:in `evaluate_init_rb'
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin.rb:44:in `load'
> >         from /Users/David/Project/Development/RailsDev/svn/pttrading/
> > config/../vendor/plugins/engines/lib/engines/plugin.rb:77:in `load'
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin/loader.rb:33:in `load_plugins'
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin/loader.rb:32:in `each'
> >         from ./script/../config/../vendor/rails/railties/lib/rails/
> > plugin/loader.rb:32:in `load_plugins'
> >          ... 31 levels...
> >         from /Users/David/Project/Development/RailsDev/svn/pttrading/
> > vendor/rails/railties/lib/commands/server.rb:39
> >         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
> > custom_require.rb:31:in `gem_original_require'
> >         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
> > custom_require.rb:31:in `require'
> >         from script/server:3
>
> > On Jul 6, 2:34 pm, Kenny Ortmann <[email protected]> wrote:
>
> > > Can you update your version of active scaffold, I just pused a change to 
> > > the
> > > version for rails-2.1
>
> > > ~kenny
>
> > > On Mon, Jul 6, 2009 at 1:09 PM, redbros <[email protected]> wrote:
>
> > > > Still getting the error.
> > > > Does this feature work for you?
> > > > Thanks for your help so far though......I really appreciate it!
>
> > > > On Jul 6, 12:56 pm, Kenny Ortmann <[email protected]> wrote:
> > > > > try
>
> > > > > config.columns[:name].clear_link
> > > > > config.columns[:name].set_link 'show', :controller => "store"
>
> > > > > On Mon, Jul 6, 2009 at 12:10 PM, redbros <[email protected]>
> > > > wrote:
>
> > > > > > :( Still the same error.
>
> > > > > > On Jul 6, 11:54 am, Kenny Ortmann <[email protected]> wrote:
> > > > > > > try just using
> > > > > > > config.columns[:name].set_link 'show'
>
> > > > > > > On Mon, Jul 6, 2009 at 11:39 AM, redbros 
> > > > > > > <[email protected]>
> > > > > > wrote:
>
> > > > > > > > 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
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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