ruby-on-rails-4

How do you add a second column of 'children' without duplicating the 'parent' column entry in Active Admin?

↘锁芯ラ 提交于 2020-03-06 03:31:46
问题 This table, Raw Table with correct output, is the result I am looking for, but how do I translate this block of code into whatever Active Admin /app/admin/postal_code.rb index view requires to output the table correctly. Currently this block is rendered in a partial, /app/views/admin/postalcode/_showtable.html.erb <h1>Postal Code per Region</h1> <table> <tr> <th>Region</th> <th>Postal Code</th> </tr> <% @region.each do |region| %> <tr> <td><%= region.name %></td> <td> <table> <% list =

Unpermitted Parameters: profile (NestedAttributes) - RAILS 4

回眸只為那壹抹淺笑 提交于 2020-03-05 05:39:50
问题 This question has many times asking by others user but still not solved my problem here. Im having a problem with my rails apps where error "Unpermitted Parameters: profile" appear. user_controller.rb class Admin::UsersController < ApplicationController before_filter :set_user, only: [:edit, :update] before_filter :store_location, only: [:index] before_filter :require_admin def edit if @user render else redirect_to admin_users_path, notice: "User profile not found." end end def update # Rails

Unpermitted Parameters: profile (NestedAttributes) - RAILS 4

﹥>﹥吖頭↗ 提交于 2020-03-05 05:39:49
问题 This question has many times asking by others user but still not solved my problem here. Im having a problem with my rails apps where error "Unpermitted Parameters: profile" appear. user_controller.rb class Admin::UsersController < ApplicationController before_filter :set_user, only: [:edit, :update] before_filter :store_location, only: [:index] before_filter :require_admin def edit if @user render else redirect_to admin_users_path, notice: "User profile not found." end end def update # Rails

syntax to use `data-toggle` and `data-target` in link_to rails 4

瘦欲@ 提交于 2020-02-25 09:59:52
问题 I have: <%= link_to :action=>'view_score_card',:id=>innings1_batting_datail.id,remote: true,:class=>"body_inner_icon" do %> In this link i want to use data-toggle="modal" and data-target="#myModal1" .Please tell me the right syntax for it. 回答1: These are link_to signatures: link_to(body, url, html_options = {}) link_to(body, url_options = {}, html_options = {}) link_to(options = {}, html_options = {}) link_to(url, html_options = {}) You want them to end up in html_options block. Try: <%= link

TinyMCE 4 insert link form fields disabled

我只是一个虾纸丫 提交于 2020-02-25 09:35:19
问题 I'm using the tinymce-rails gem which uses TinyMCE 4 and I'm loading the link plugin and all this is initiated after/in a colorbox popup. TinyMCE editor is working perfectly but the link button brings up a dialog to add/edit a link, but none of the fields except the target are available for editing. below is the related code: setup_new_message: -> tinyMCE.init selector: '.tinymce' plugins: "textcolor link" menubar: false toolbar: "formatselect | fontselect | bold italic underline | forecolor

TinyMCE 4 insert link form fields disabled

喜欢而已 提交于 2020-02-25 09:34:47
问题 I'm using the tinymce-rails gem which uses TinyMCE 4 and I'm loading the link plugin and all this is initiated after/in a colorbox popup. TinyMCE editor is working perfectly but the link button brings up a dialog to add/edit a link, but none of the fields except the target are available for editing. below is the related code: setup_new_message: -> tinyMCE.init selector: '.tinymce' plugins: "textcolor link" menubar: false toolbar: "formatselect | fontselect | bold italic underline | forecolor

Need help to understand `has_and_belongs_to_many`

烂漫一生 提交于 2020-02-25 07:49:27
问题 There are three tables in the database: users (not empty) schedules (not empty) schedules_users ( empty ) user-model: class User < ActiveRecord::Base [...] has_and_belongs_to_many :schedules#has_many :schedules [...] end schedule-model: class Schedule < ActiveRecord::Base has_and_belongs_to_many :users#belongs_to :user end welcome-controller: (where I want to sort the schedules by date and time) class WelcomeController < ApplicationController def index if(current_user) @user_schedules =

Is rails 4 find_by deprecated?

僤鯓⒐⒋嵵緔 提交于 2020-02-21 10:36:06
问题 I heard that find_by is deprecated is this true? I have been thinking of alternatives such as creating for each find a different method, e.g.: before: Model.find_by_username 'username' after: --in model--- class << self def by_username username where(:username => username).first end end is it a good naming? what names do you give for such methods? Update: find_by is not deprecated but the announcement could have been clearer! 回答1: According to the Rails 4 Release Notes: All dynamic methods

CarrierWave Backgrounder process leaves denied access to s3 image

拜拜、爱过 提交于 2020-02-08 09:15:47
问题 My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg I would like for this process to be done in the background. def create @photo = Photo.new(photo_params) if @photo.save UploadsWorker

CarrierWave Backgrounder process leaves denied access to s3 image

旧时模样 提交于 2020-02-08 09:15:09
问题 My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg I would like for this process to be done in the background. def create @photo = Photo.new(photo_params) if @photo.save UploadsWorker