Comments (3)
Should you be using collection_select instead?
from casein.
This is how I've used casein_select for one-to-one relationships before. I can't see any reason why multiple wouldn't be passed through. If you're able to share your project with me, I can take a look.
<%= casein_select f, f.object, :column, Column.order(:title).collect {|c| [c.title.titlecase, c.id]}, {:include_blank => '-- None --', :casein_label => "Choose an existing column"} %>
As for other advice: in general, you can use the form partials directly for nested attributes:
<%= f.fields_for :column do |column_form| %>
<%= render :partial => 'casein/columns/form', :locals => { :f => column_form } %>
<% end %>
Casein's support for relationships in the scaffolding isn't great, but when not using nested attributes, I usually scaffold out the child models using the --no-index option (this stops it being added to the tabbed navigation, removes the unneeded controller methods, limits the appropriate routes, etc.) which will generate all the view partials. Then I add render the child's _index partial at the bottom of the parent's show view, plus I add a button to create a new child object into the sidebar of the parent's show view. It requires a little copying and pasting, but you can quickly build up the views.
Getting better automated support for relationships in the scaffolder would be great though β I just don't have time right now, but I'm always looking for help to expand the project ;)
from casein.
Thanks so much for the help, and the quick reply! Much appreciated! I got the form to render- still working through a few things but overall everything makes sense. We all really like how straighforward/lightweight Casein is.
If we end up using Casein in our project, we'll definitely look into helping with the scaffolding for relationships :) Thanks so much for making this project open source!
from casein.
Related Issues (20)
- Rails 6 support? HOT 7
- casein 5.4.0 authlogic HOT 1
- Webpack Rails 5
- Use UTC in views and basecamp/local_time to convert to usersβ local time HOT 5
- OmniAuth? HOT 1
- Override Casein templates HOT 1
- [calibration error] scrypt.rb:142:in `__sc_calibrate' HOT 1
- How can I generate admin users view HOT 3
- Rails 5? HOT 18
- Polymorphism HOT 1
- Using Bootsy WYSIWYG with Casein HOT 3
- how can I create an admin user in production env? HOT 1
- Possibility to use mongo db HOT 5
- Casein 5.2 - AdminUserSessions#new HOT 4
- has_many models within the form HOT 3
- Renaming the casein route HOT 1
- Redirecting to localhost HOT 5
- Glyphicons not working HOT 1
- Requirement of another ruby version HOT 2
- SQLite deprecation message when run rspec HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from casein.