On Lunes, 24 de Enero de 2011 12:00:43 luckydev escribió:
> I have a join model that just belongs to two other models.
> 
> class Movie
> has_many :cinema_movies
> has_many :cinemas, :through => :cinema_movies
> end
> 
> class Cinema
> has_many :cinema_movies
> has_many :movies, :through => :cinema_movies
> end
> 
> class Cinema_Movie
> belongs_to :cinema
> belongs_to :movie
> end
> 
> I have active scaffold on Cinema_Movie model.
> 
> This is how I've configured in cinema movie controller file.
> 
>   active_scaffold :cinema_movie do |config|
> 
>     config.label = "Shows"
> 
>     #Create
>     config.create.link.label = "Add a new cinema"
>     config.columns['listing'].label = "Cinema"
> 
> 
>   end
> 
> 
> When creating a new record of Cinema_Movie, I need to exclude several
> attributes of cinema association. I guess i have to do with subforms,
> but I am not sure about how to do this... how should i exclude several
> attributes of my associations from getting added/modified when I click
> create/edit links in active scaffold.

You configure columns for subform in cinema controller and movie controller:
class CinemasController < ...
  active_scaffold do |config|
    config.subform.columns = [...] # or
    config.subform.columns.exclude .....
  end
end

And the same for MoviesController.

-- 
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