-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
habtm in rails 4.1 #379
Comments
Remove backtrace silencers (config/initializers/backtrace_silencers.rb) and post trace of error |
ctivemodel (4.1.0) lib/active_model/attribute_methods.rb:435:in |
What is your active_scaffold config block in that controller? It seems like trying to display multinationalcompanies_stock_exchange_countries column instead of stock_exchange_countries |
Hi Sergio, this one is pretty simple actually...it looks to be getting the class MultinationalCompaniesController < ApplicationController active_scaffold :"multinational_company" do |config|
makes no diff.... end On Fri, Jan 9, 2015 at 10:34 AM, Sergio Cambra notifications@github.com
|
Try to exclude :multinationalcompanies_stock_exchange_countries column I haven't used ActiveScaffold with Rails 4.1 yet because of some rails 4.1 bug, I have only tested against rails 4.1 with some automated tests, although many features are not tested yet. Maybe that internal association will be excluded by default in the future. |
Good call Scambra! That worked. Now if i could just figure out how to create a multi-select out of this i would be in business! I already tried the form_ui = :multi_select (from the api) but it didnt seem to work. I excluded these: :multinationalcompanies_stock_exchange_countries) config.columns.exclude( :multinationalcompanies_stock_exchanges, and it worked.... then added:
and i at least get the checkboxes for the ui. Just wish i could have multiselect which is a rather useful form ui for this cause. THanks for all you help, again Scrambra! cheers |
There is no :multi_select form_ui. There is a :multi_select search_ui but it's displayed as checkbox list too, and it's only for singular associations where you want to allow searching for multiple values. You can enable draggable lists with: config.columns[:stock_exchanges].options = {:draggable_lists => true} It's not the same but it's better than checkboxes. Also, you can create your own override for that column in your helper. Or create your own form_ui in ApplicationHelper, named like active_scaffold_input_multi_select(column, html_options) |
Hi,
I am trying to use the habtm feature of rails in activescaffold. I didnt think this would be so troublesome and at this point i am not sure if i am finding a bug or not doing something right in AS. So i have a very simple model that has a habtm like such...
class MultinationalCompany < ActiveRecord::Base
has_and_belongs_to_many :stock_exchange_countries
end
When i try to list (or do anything with this AS controller now I get:
Showing /home/mark/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/active_scaffold-3.4.11/app/views/active_scaffold_overrides/_list_record.html.erb where line #12 raised:
undefined method `multinationalcompanies_stock_exchange_countries' for #MultinationalCompany:0x007f17798182f0
undefined method `multinationalcompanies_stock_exchange_countries' for #MultinationalCompany:0x007f17798182f0
<% columns.each do |column| %> <% authorized = record.authorized_for?(:crud_type => :read, :column => column.name) -%> <% column_value = authorized ? get_column_value(record, column) : active_scaffold_config.list.empty_field_text -%> <%= content_tag :td, column_attributes(column, record).merge(:class => column_class(column, column_value, record)) do %> <%= authorized ? render_list_column(column_value, column, record) : column_value %>I know this works because i can add items to the habtm tables via console. Just not sure why AS is looking for a method like this.
Thanks in advance.
mark
The text was updated successfully, but these errors were encountered: