Rails 4 simple_form has_many through check boxes not saving

Rails 4 simple_form has_many through check boxes not saving

Content Index :

Rails 4 simple_form has_many through check boxes not saving
Tag : ruby-on-rails , By : UnKnownUser
Date : November 25 2020, 07:22 PM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Using Toggle Buttons in place of Check boxes (Rails, Twitter Bootstrap, Simple_form)

Tag : ruby-on-rails , By : Nougat
Date : March 29 2020, 07:55 AM
should help you out I've come up with a JS based approach... I'm sure it's not the nicest way of doing it, but it works...
In your view file, add something along the lines of this:
<div id="client_approved_buttons" class="btn-group" data-toggle="buttons-radio">
  <%= f.input : client_approved, as: :hidden %>
  <a class="btn" data-value="1">Yes</a>
  <a class="btn" data-value="0">No</a>
// make button toggles update hidden field
$('.btn-group a').on('click', function(event){
  var input = $(this).siblings('.control-group').find('input[type=hidden]');
    if(input.val().toString() !== $(this).data('value').toString()){

How do I render check boxes with simple_form?

Tag : ruby-on-rails-3 , By : Feroz
Date : March 29 2020, 07:55 AM
help you fix your problem simple_form will bind the selected options to the params[:content_type] variable.
Note: content_type_options can also be a hash containing pairs of option/value. e.g. {'Blog' => 'blog', 'Editorial' => 'editorial', ...}

Rails has_many through with simple_form devise registration

Tag : ruby-on-rails , By : Tigre
Date : March 29 2020, 07:55 AM
This might help you As position_ids would be passed as an array, you need to update configure_permitted_parameters as below:
  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :position_ids => []) }

Has_many through checkboxes (simple_form) not saving

Tag : ruby-on-rails , By : apple
Date : March 29 2020, 07:55 AM
Any of those help I am trying to sort comments into events using a has_many :through association using checkboxes however the selected events are not saved. Here are my models: , Try:
def comment_params
  params.require(:comment).permit(:post_id, :title, :event_ids => [])

How should I use nested attributes with simple_form, Rails 4, and has_many?

Tag : ruby-on-rails , By : esimran
Date : March 29 2020, 07:55 AM
Any of those help A couple of changes should fix your issue:
Ensure @user object has an application instance built before the form is rendered. Ensure you use form_builder.simple_fileds_for :applications, i.e. plural applications as your association is has_many.
class UsersController < ApplicationController
  def new
    @user = User.new
<%= f.simple_fields_for :applications do |a| %>
  <%= a.input :over_18, label: 'Are you over 18?', as: :radio_buttons %>
<% end %>
Related Posts Related QUESTIONS :
  • Rails 6 and Google Maps for Rails
  • Ruby .map hash values to key value pair in array
  • Rails Frontend, Backend, and API
  • How to make value attribute in the select option tag to have url's in rails
  • Can I apply methods to a model.where condition to get all object created in specific month?
  • With Capybara, how do you get assertions on transient elements to work?
  • Best way to combine results of two select statements without returning an array?
  • How add extra attribute in model object response in rails
  • How can I block file uploads in Rails?
  • how does has_many :through work with only two models?
  • validating attribute presence with condition
  • How to fix "Illegal Argument Exception" when creating an Elasticsearch index for a Rails model?
  • Rails / Ruby how to always show decimal precision
  • Problem accessing images uploaded to heroku thru RoR application
  • How do I create a new path/route in Ruby and then link to it?
  • Rails Migration To Add Index To The Difference Between 2 Columns
  • i am trying to show my posts title on show page but it shows this error again and again . i am beginner in rails
  • Syntax Error for Ruby on Rails "(" unexpected
  • Upgrading from Rails 4.2.1
  • Reset master to an empty state
  • Ruby .round() function rounding off the values, but storing the original value only in database
  • Is it possible to email users who are @mentioned in rails ActionText?
  • Skip Current Migrations but Apply Future Ones
  • How to handle data with two has_many associations
  • Show SQL ActiveRecord queries in rails console using SemanticLogger gem
  • Custom strategy for Omniauth
  • How to obtain constant memory usage when migrating a Rails application from mongoid (MongoDB) to ActiveRecord (Postgres)
  • how do i redirect to home page(root )when user signed out?
  • Ruby two strings in an IF condition
  • Nginx passenger integration mode always require Passengerfile.json file?
  • what class is returned after a delete action in rails
  • Convert an array of hash with symbols
  • How can i display a particular product?
  • Rails remove subarray from array
  • Ruby : How to record an object and reuse it for tests?
  • Rails multiple select on array attribute not working
  • How use local views built with gem devise in rails app?
  • Deploying Rails App on Digital Ocean and when running cap production deploy:initial I get back ---> 01 ArgumentError:
  • How do I seed data of a class which requires the user_id of the current user?
  • How to do an RSpec oneliner to test a :count change
  • Rails 5 left_outer_join with specific saved ID
  • Rails: devise_invitable not accepting variables
  • How to spy on a method called at class level on ActiveRecord model?
  • Azure AD authentication with Rails and devise
  • Avoiding n+1 has_many children should remember parent
  • Ruby/Rails How to parse datetime from russian string
  • How to remove substring that may appear within a string?
  • param is missing or the value is empty: But parameter IS there with a value
  • What is cost/benefit of object.models.find() vs Model.find() in Ruby on Rails (Mongoid)
  • User is getting session from other logged in user with Rails / Devise
  • How to run docker compose up for production environment
  • In Rails 5 where should I put my javascript_include_tag?
  • Rubocop -> Use a guard clause
  • How does assigns know where to look for the instance variable in integration tests?
  • Rails 5.2.3 converting all params datatype to string when testing using rspec
  • RegEx for client-side server in Ruby on Rails
  • Aws CostExplorer Api giving exception using ruby sdk
  • rails webpack compilation hangs in production at 78% [0] chunk asset optimization TerserPlugin
  • How to remove an object from the ActiveRecord::Relation object
  • Where does http protocol rests in rails framework?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com