Hi Johnny, thanks for your reply!
On 23 Mai, 16:24, johnnybutler7 <[email protected]> wrote: > in the checkbox list but not the entire model. You should be able to > get this by changing :categorizations to :categories in your blog > controller but as i stated then the edit wont sane any updates. Will > see if any of the community come with something to help. That what I had started with but if I do I get this error: ------------ NoMethodError in Blogs#index Showing vendor/plugins/active_scaffold/frontends/default/views/ _list_record.html.erb where line #14 raised: undefined method `blog_id=' for #<Category:0xb704fff8> Extracted source (around line #14): 11: <% column_value = get_column_value(record, column) -%> 12: 13: <td class="<%= column_class(column, column_value) %>" > 14: <%= record.authorized_for?(:action => :read, :column => column.name) ? render_list_column(column_value, column, record) : '' %> 15: </td> 16: <% end -%> 17: <% if active_scaffold_config.action_links.any? {|link| link.type == :record } -%> -------- It toook me ages to come up with the :categorizations appraoch since it doesnt make much sense but it shows me what I want in the listing, albeit not what I need in the edit and update view... I really don't get from the little documentation that does exist on the active_scaffold site once would assume that this should work, albeit it does not... Leaves me puzzled... > > For your 2nd point you have a couple of options. Probably the easiest > is to exclude the exisiting show link like so and then add a new one > to your config.columns. > So in you blogs controller add :new_show to your exisiting columns > config.columns = > [:title, :body, :is_posted, :categorizations, :new_show ] > > and in you blogs helper add something like the below to make the > new_show field an active link > config.columns :new_show > > def new_show_column(record) > link_to "Show", :controller => 'blogs', :action => 'show', :id => > record) > end > > The other option is to overrite the partial that displays the action > links which may take a bit more time digging arouns. > Will try the first approach :-) Looks like less work! Cheers Juergen > JB > > On 23 May, 14:05, helmerj <[email protected]> wrote: > > > Hi! > > > I have trying to switch an existing application over to > > active_scaffold. I use several "has_many through" relationships in a > > number of models to let the user specify a set of features for each > > model. > > > I have created a simple test application using rails 2.3 and > > active_scaffolds master branch. Following the README I have also > > installed the render_component plugin. > > > I have two models, blog and category and the categorization model > > connecting them as follows: > > > class Category < ActiveRecord::Base > > has_many :categorizations > > has_many :blogs, :through => :categorizations, :source => :blog > > end > > > class Blog < ActiveRecord::Base > > has_many :categorizations > > has_many :categories, :through => :categorizations, :source > > => :category > > validates_presence_of :title, :body > > end > > > class Categorization < ActiveRecord::Base > > belongs_to :blog > > belongs_to :category > > > #set the name of categorizations column in blog listing to categories > > names > > def to_label > > "#{category.name}" > > end > > end > > > After a long struggle I have figured out how to actually have anything > > displayed at all: > > > In my blogs controller I have this: > > > class BlogsController < ApplicationController > > active_scaffold :blog do |config| > > config.columns = [:title, :body, :is_posted, :categorizations ] > > > config.columns[:categorizations].form_ui = :select > > config.columns[:categorizations].label = "Categories" > > > config.columns[:is_posted].label = "Entry posted?" > > config.columns[:is_posted].form_ui = :checkbox > > end > > end > > > This will display all categories with the correct name from the > > category table as assigned in the categorizations table. > > > GREAT! > > > BUT: > > > 1. When I click on the edit button for any record I do not see all > > categories available in the categories table but only any category > > that is currently assign or has been assigned before, since the > > unchecking of a category only removes the blog_id entry from the > > categorizations table but not the entry itself. > > > Question: How can I have all available categories listed in the edit > > view? > > > 2. The category entries are linked (http://localhost:3000/blogs/1/ > > nested?_method=get&associations=categorizations) How would I change > > the link to the show page of the associated category? > > > I am sorry if this is trivial. I have tried to find a howto or any > > other documentation on the matter but was not able to find anything > > helpful. > > > Thanks in advance for any help > > > Cheers Juergen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
