Saturday, May 14, 2016

How we can automatically inject liquid code inside shop's theme using shopify app? | Fixed issues

How we can automatically inject liquid code inside shop's theme using shopify app? | Fixed issues


How we can automatically inject liquid code inside shop's theme using shopify app?

Posted: 14 May 2016 07:13 AM PDT

I'm building a Shopify application and I'm interested in automatically adding a liquid content into the shop's theme.

How to display params from a different Model within the /show of a different Model?

Posted: 14 May 2016 07:13 AM PDT

Working on an app in rails 4 that has Invoices and Clients as Models - I already set the associations between them as you can see in the snippets below from both Models, but can't achieve how to display for instance the Client.name within an Invoice show view.

Through Rails console, if I do 'Invoice.last.client.name' - I can see the client name - but once I try to show that same thing in the view with this piece of code:

  <% @invoices.each do |invoice| %>      <%= invoice.client.name %>    <% end %>  

I get this error undefined method `name' for nil:NilClass

Invoice.rb (Model)

class Invoice < ActiveRecord::Base    belongs_to :client    acts_as_schedulable :schedule      # accepts_nested_attributes_for :clients    end  

Client.rb (Model)

class Client < ActiveRecord::Base    has_many :invoices    validates_formatting_of :email, using: :email  end  

Tried adding doing something with nested attributes and adding the 'name' method in the Invoice controller, but don't know what I'm doing wrong. For more reference, I have included the whole Invoice controller in this pastebin link.

  def name      @invoice = Invoice.client.name    end  

Rails session is not changing value

Posted: 14 May 2016 06:09 AM PDT

consider the code below

def results      params_list = []      params.each_pair {|key, value|        params_list.push([key,value])      }      p params_list      session.delete(:image)      p session[:image]      @image = Gchart.pie_3d(:size => '500x300',                :title => "Top 5 Results",                :legend => ["#{params_list[0][0]} #{params_list[0][1]}%" , 'source-document2 [22%]','source-document3','source-document4','source-document5'],                :data => [22, 21, 20, 18, 19])        session[:image] = @image        respond_to do |format|        format.html { head 200, content_type: "text/html" }      end      end      def check_results        if session[:image]        @image = session[:image]        respond_to do |format|          format.js        end      end    end  

as you can see i delete the session[:image] and then reassign it. But when call it from the check_results action, i get the very first session i stored.

Why is that?

Can't start Rails server! "getaddrinfo: Name or service not known (SocketError)"

Posted: 14 May 2016 07:01 AM PDT

When I try to run my rails app using

RAILS_ENV=production rails s -binding=128.199.95.219  

I get this error

/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/socket.rb:232:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/socket.rb:232:in `foreach'  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/socket.rb:459:in `tcp_server_sockets'  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/utils.rb:70:in `create_listeners'  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:133:in `listen'  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:114:in `initialize'  from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:45:in `initialize'  from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in `new'  from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in `run'  from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:80:in `start'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'  from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'  from bin/rails:4:in `require'  from bin/rails:4:in `<main>'  

I've googled many places but still find no definite answer which could solve this problem.

My app is running in Ubuntu (14.0.4) with Nginx and Unicorn at DigitalOcean

Any idea anyone?

Is it advisable to use :foreign_key in my migrations rather than just adding user_id?

Posted: 14 May 2016 06:14 AM PDT

I am using rails 4.2, I just want to know if there would be any difference if I use the :foreign_key keyword in my migrations rather than just adding a user_id column to add relationship to my models ?

Annoying issue with Rails migration

Posted: 14 May 2016 04:39 AM PDT

Its not a problem but more like an annoying step which i have to repeat every time i made a mistake. I created a migration which like this:

class CreateSubmissions < ActiveRecord::Migration    def change      create_table :submissions do |t|        t.references :student, index: true, foreign_key: true        t.references :assignment, index: true, foreign_key: true        t.references :question, index: true, foreign_key: true          t.text :code          t.timestamps null: false      end      add_index :submissions, [:student_id, :assignment_id, :question_id], unique: true    end  end  

try to rub rake db:migrate and it give me error that index name is too long and more, i change that line to this

add_index :submissions, [:student_id, :assignment_id, :question_id],                               unique: true, name: 'index_submissions'  

and again try to execute rake db:migrate at that time it give me error that submission_student_index already exists (because the first time it created the table but throw exception while adding index) i tried to rollback so that i can execute whole submissions table and index together but unfortunately it rollback my previous migration (in some cases a previous table or index or column).

For that i have to manually go to the database and drop that submissions table and then execute rake db:migrate to create submissions table along with the all the index and also that previous migration. Its annoying to go back to the database and manually drop the table, i don't know if i am doing something wrong or there is some better way to this.

How to remove link name after is visited

Posted: 14 May 2016 04:46 AM PDT

I have and app with some question. My links are numbers 1,2,3 ect.

Each of this link is a path to another question. I made that visited link changes color but that option is not good. It's not good because when I once open that link it show it in color which I set for visited link. But when I delete from DB that question and add new it has again number 1 as link and it is shown as visited.

This is part of code where I have done that:

<% @categories.each do |category| %>      <div id=<%= "box#{category.id}" -%>>          <h1><%= category.name %></h1>          <% category.questions.each_with_index do |question, i| %>          <ul class="question-list" style="display: inline;">               <li><%= link_to (i + 1), show_path(question_id: question.id) %></li>          </ul>  <% end %>  

This part look like this. below each category are questions.

Category

1 2 3 4

I do not want delete question from database. I only want to delete link.

So if I open question with number 1 and when I go back I want that this number 1 as link disappear and then I will have like this.

Category

2 3 4

Question: How to delete just link name after link is visited?

Rails, hooking into controllers

Posted: 14 May 2016 05:43 AM PDT

OK, here's my problem:

I have a HomeController with an action, say index, that would render a landing page for my site. The site also has a bunch of other Controllers that implement actions for various other functionalities.

I want a dynamic navigation bar on my home page and what I'm looking for is that HomeController#index goes to every other Controller in my app and calls a particular method that would return and object with link details, for example, HomeController#index would go to ContactController and call a method get_link which would return something like:

{label: "Contact", url: "/contact"}  

Similarly HomeController#index would try calling get_link on every other controller until it has collected an Array of link objects which could then be passed to the View to render navigation.

I tried doing this through metaprogramming in Modules and using included hook method (getting my references from a Sitepoint tutorial). But that didn't work. Then I read somewhere that I may have to use ActiveSupport::Concern for ths kind of functionality, but I'm not sure how to go about it. I've worked on PHP CMS like Drupal and WordPress any they implement this using hooks, which is more-or-less what I'm looking for here. Any ideas?

Why is single table inheritance a bad design choice?

Posted: 14 May 2016 04:40 AM PDT

Whenever I see any discussion about single table inheritance it is generally seen to be a bad idea, due to the fact that it introduces a lot of columns in the table which will always be empty, depending on the row.

In reading around on this subject I came across this post on stackoverflow:

how to avoid polymorphic associations

The answer suggested seems to introduce the exact thing that single table inheritance introduces (and is seen as a bad thing..), but it is the solution in this case? Surely the answer given to this question just introduces a lot of empty columns into the table?

If it is perfectly fine to do this, and there is essentially no performance cost to doing it, why is STI better to be avoided?

I had accepted that having a lot of empty columns would be a poor design choice, and if it is not, I don't understand why it isn't?

Set attributes when automatically building has_one child model

Posted: 14 May 2016 03:58 AM PDT

I'm attempting to automatically build a child model when its parent is created, as noted in this post. Say I have two models Person has_one :folder and I would like to create a folder when the person creates To do this I go into the Person model and (from the example above) do the following.

has_one :folder  before_create :build_default_folder    private  def build_default_folder    build_folder    true  end  

This makes sense, but say Profile had some attributes that I would like to set an attribute for Folder based on the Person's attributes. Like if the person has :person_name what should I do to set :folder_name as "[person_name]'s_Folder"?

Thanks for any suggestions.

The action 'redirect_callbacks' could not be found for Users::OmniauthCallbacksController

Posted: 14 May 2016 04:39 AM PDT

I have a problem with omniauth and devise_token_auth. When i try to register an user with facebook, the callback not working.

Her's my Gemfile :

gem 'rack-cors', :require => 'rack/cors'  gem 'devise_token_auth'  gem 'omniauth'  gem 'omniauth-facebook'  gem 'devise', '~> 3.2'  

Routes.rb

Rails.application.routes.draw do    namespace :api, defaults: { format: :json } do         scope :v1 do           mount_devise_token_auth_for 'User', at: 'auth', :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }           match 'auth/:provider/callback', to: 'sessions#create', via: [:get, :post]        end    end    root to:'welcomes#index'  end  

Here's the app/controllers/users/omniauth_callbacks_controller.rb

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController    def facebook      # You need to implement the method below in your model (e.g. app/models/user.rb)      @user = User.from_omniauth(request.env["omniauth.auth"])        if @user.persisted?        sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated        set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?      else        session["devise.facebook_data"] = request.env["omniauth.auth"]        redirect_to new_user_registration_url      end    end      def failure      redirect_to root_path    end  end  

config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do    provider :facebook, "XXX", "XXX",    :scope => 'public_profile,email,user_birthday',    :info_fields => 'id,about,birthday,email,first_name,gender,last_name'  end  

And finally, this is the console response :

Started GET "/api/v1/auth/facebook" for 192.168.33.1 at 2016-05-14 10:26:00 +0000  Cannot render console from 192.168.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255      Started GET "/omniauth/facebook?resource_class=User" for 192.168.33.1 at 2016-05-14 10:26:00 +0000  Cannot render console from 192.168.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255  I, [2016-05-14T10:26:00.995076 #3226]  INFO -- omniauth: (facebook) Request phase initiated.      Started GET "/omniauth/facebook/callback?code=XXX" for 192.168.33.1 at 2016-05-14 10:26:01 +0000  Cannot render console from 192.168.33.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255  I, [2016-05-14T10:26:01.130357 #3226]  INFO -- omniauth: (facebook) Callback phase initiated.    AbstractController::ActionNotFound (The action 'redirect_callbacks' could not be found for Users::OmniauthCallbacksController):  

Am I missing something simple? I've been searching for a solution for the last few day

Creating Like & view Count

Posted: 14 May 2016 03:44 AM PDT

im working on a project using Ruby on rails. The website currently allows somebody to create a post & view however i want to add a way a visitir can like the post and also see how many views there have been. im super new to ruby on rails so apologies if this is basic stuff lol

Angularjs Setup on Rails

Posted: 14 May 2016 03:17 AM PDT

I wan't to use angular js on my rails project. I need to get data with json from rails.

So i want to know;

  1. How i can to integrate angularjs to my rails project
  2. How i can create angular views or how i need configure to rails mvc for angular
  3. How i can get data from rails with json

I want to do an example simple model like

rails g scaffold Post title:string body:text   

and front end will be angularjs.

How to convert UTC time to configured timezone in rails 4

Posted: 14 May 2016 03:33 AM PDT

I received a time string from a server and I want to parse or convert that string to configured time zone (Tokyo timezone in my case):

  • Input: "2016-05-27T09:00:00.0000000"
  • Expected output: Fri, 27 May 2016 18:00:00 JST +09:00

I try to type like this:

Time.zone.parse("2016-05-27T09:00:00.0000000")
but it returns unexpected output:
Fri, 27 May 2016 09:00:00 JST +09:00

Devise :: Trouble registering with custom fields to sign_up form

Posted: 14 May 2016 06:18 AM PDT

I am building a Rails application and I have some issues while registering users with Devise (and ActiveAdmin).
To the original sign_up form, I added a custom username field and this one cause me troubles: sometime user can register other time it doesn't (a validation error is raised for the username permitted params whereas I specified in controller I was allowing it).

Here is my user model:

class User < ActiveRecord::Base    validates :username,              presence: true,              uniqueness: {                case_sensitive: false,                scope: :provider              },              if: proc { |u| u.new_record? || u.changed? }      # other stuff here  end  

Here is what I have set up in my controller:

class ApplicationController < ActionController::Base    before_action :configure_permitted_parameters, if: :devise_controller?      protected      def configure_permitted_parameters      devise_parameter_sanitizer.for(:sign_up) << :username    end  end  

When the validation error is raised for username, I guess it's because this code is never called and this is where I'm stuck.

In development, I have to kill all ruby processes and then it work again for 3 or 4 registrations and then raise error again.

So what's could be wrong with my code ???

Thanks for your help !

Edit:
I discovered when I make a modification to my ruby code it stop working (unit tests stop passing). Could it be a cache issue ?

Edit 2: here are my development logs for sign_up when it fails

14:19:05 web.1         | [INFO ] POST    "/admin"  for 127.0.0.1  at 2016-05-14 14:19:05 +0200  14:19:05 web.1         | [DEBUG]   Setting Load (0.6ms)  SELECT  `settings`.* FROM `settings`  ORDER BY `settings`.`id` ASC LIMIT 1  14:19:05 web.1         | [DEBUG]   Setting::Translation Load (0.8ms)  SELECT `setting_translations`.* FROM `setting_translations` WHERE `setting_translations`.`setting_id` = 1  14:19:05 web.1         | [DEBUG]   Category Load (0.8ms)  SELECT  `categories`.* FROM `categories` WHERE `categories`.`name` = 'LegalNotice' LIMIT 1  14:19:05 web.1         | [DEBUG]   Menu Load (0.6ms)  SELECT `menus`.* FROM `menus` WHERE `menus`.`id` IN (8)  14:19:05 web.1         | [DEBUG]   Menu::Translation Load (0.6ms)  SELECT `menu_translations`.* FROM `menu_translations` WHERE `menu_translations`.`menu_id` IN (8)  14:19:05 web.1         | [DEBUG]   Category Load (0.6ms)  SELECT  `categories`.* FROM `categories` WHERE `categories`.`name` = 'Registration' LIMIT 1  14:19:05 web.1         | [DEBUG]   OptionalModule Load (1.1ms)  SELECT  `optional_modules`.* FROM `optional_modules`  ORDER BY `optional_modules`.`id` ASC LIMIT 1000  14:19:06 web.1         | [DEBUG]   AdultSetting Load (0.6ms)  SELECT  `adult_settings`.* FROM `adult_settings`  ORDER BY `adult_settings`.`id` ASC LIMIT 1  14:19:06 web.1         | [DEBUG]   AdultSetting Load (0.4ms)  SELECT `adult_settings`.* FROM `adult_settings`  14:19:06 web.1         | [DEBUG]   AdultSetting::Translation Load (0.3ms)  SELECT `adult_setting_translations`.* FROM `adult_setting_translations` WHERE `adult_setting_translations`.`adult_setting_id` = 1  14:19:06 web.1         | [DEBUG]   Slider Load (0.4ms)  SELECT  `sliders`.* FROM `sliders` INNER JOIN `categories` ON `categories`.`id` = `sliders`.`category_id` WHERE `sliders`.`online` = 1 AND (categories.name = 'Registration')  ORDER BY `sliders`.`id` ASC LIMIT 1  14:19:06 web.1         | [DEBUG]   VideoSetting Load (0.3ms)  SELECT  `video_settings`.* FROM `video_settings`  ORDER BY `video_settings`.`id` ASC LIMIT 1  14:19:06 web.1         | [DEBUG]    (0.1ms)  BEGIN  14:19:06 web.1         | [DEBUG]   User Exists (0.6ms)  SELECT  1 AS one FROM `users` WHERE `users`.`email` = BINARY 'demo22@demo.fr' LIMIT 1  14:19:06 web.1         | [DEBUG]   User Exists (2.8ms)  SELECT  1 AS one FROM `users` WHERE (`users`.`username` IS NULL AND `users`.`provider` IS NULL) LIMIT 1  14:19:06 web.1         | [DEBUG]   User Exists (0.3ms)  SELECT  1 AS one FROM `users` WHERE (`users`.`email` = 'demo22@demo.fr' AND `users`.`provider` IS NULL) LIMIT 1  14:19:06 web.1         | [DEBUG]    (0.2ms)  ROLLBACK  14:19:06 web.1         | [DEBUG]   OptionalModule Load (0.4ms)  SELECT  `optional_modules`.* FROM `optional_modules` WHERE `optional_modules`.`name` = 'SocialConnect' LIMIT 1  14:19:06 web.1         | [DEBUG]   SocialConnectSetting Load (0.2ms)  SELECT  `social_connect_settings`.* FROM `social_connect_settings`  ORDER BY `social_connect_settings`.`id` ASC LIMIT 1  14:19:06 web.1         | [DEBUG]   SocialProvider Load (0.3ms)  SELECT `social_providers`.* FROM `social_providers` WHERE `social_providers`.`enabled` = 1  14:19:07 web.1         | [INFO ] method=POST path=/admin format=html controller=registrations action=create status=200 duration=1306.84 view=1185.47 db=11.72 unpermitted_params=["username"]  

here are my development logs for sign_up when it works

13:23:23 web.1         | [INFO ] POST    "/admin"  for 127.0.0.1  at 2016-05-14 13:23:23 +0200  13:23:23 web.1         | [DEBUG]   Setting Load (0.4ms)  SELECT  `settings`.* FROM `settings`  ORDER BY `settings`.`id` ASC LIMIT 1  13:23:23 web.1         | [DEBUG]   Setting::Translation Load (0.3ms)  SELECT `setting_translations`.* FROM `setting_translations` WHERE `setting_translations`.`setting_id` = 1  13:23:23 web.1         | [DEBUG]   Category Load (0.3ms)  SELECT  `categories`.* FROM `categories` WHERE `categories`.`name` = 'LegalNotice' LIMIT 1  13:23:23 web.1         | [DEBUG]   Menu Load (0.3ms)  SELECT `menus`.* FROM `menus` WHERE `menus`.`id` IN (8)  13:23:23 web.1         | [DEBUG]   Menu::Translation Load (0.4ms)  SELECT `menu_translations`.* FROM `menu_translations` WHERE `menu_translations`.`menu_id` IN (8)  13:23:23 web.1         | [DEBUG]   Category Load (0.3ms)  SELECT  `categories`.* FROM `categories` WHERE `categories`.`name` = 'Registration' LIMIT 1  13:23:23 web.1         | [DEBUG]   OptionalModule Load (0.4ms)  SELECT  `optional_modules`.* FROM `optional_modules`  ORDER BY `optional_modules`.`id` ASC LIMIT 1000  13:23:23 web.1         | [DEBUG]   AdultSetting Load (0.3ms)  SELECT  `adult_settings`.* FROM `adult_settings`  ORDER BY `adult_settings`.`id` ASC LIMIT 1  13:23:23 web.1         | [DEBUG]   Slider Load (0.4ms)  SELECT  `sliders`.* FROM `sliders` INNER JOIN `categories` ON `categories`.`id` = `sliders`.`category_id` WHERE `sliders`.`online` = 1 AND (categories.name = 'Registration')  ORDER BY `sliders`.`id` ASC LIMIT 1  13:23:24 web.1         | [DEBUG]   VideoSetting Load (0.7ms)  SELECT  `video_settings`.* FROM `video_settings`  ORDER BY `video_settings`.`id` ASC LIMIT 1  13:23:24 web.1         | [DEBUG]    (0.2ms)  BEGIN  13:23:24 web.1         | [DEBUG]   User Exists (0.5ms)  SELECT  1 AS one FROM `users` WHERE (`users`.`id` IS NOT NULL) AND `users`.`slug` = 'demo18' LIMIT 1  13:23:24 web.1         | [DEBUG]   User Exists (0.4ms)  SELECT  1 AS one FROM `users` WHERE `users`.`email` = BINARY 'demo18@demo.fr' LIMIT 1  13:23:24 web.1         | [DEBUG]   User Exists (11.0ms)  SELECT  1 AS one FROM `users` WHERE (`users`.`username` = 'demo18' AND `users`.`provider` IS NULL) LIMIT 1  13:23:24 web.1         | [DEBUG]   User Exists (0.3ms)  SELECT  1 AS one FROM `users` WHERE (`users`.`email` = 'demo18@demo.fr' AND `users`.`provider` IS NULL) LIMIT 1  13:23:24 web.1         | [DEBUG]   SQL (4.3ms)  INSERT INTO `users` (`email`, `encrypted_password`, `username`, `slug`, `created_at`, `updated_at`) VALUES ('demo18@demo.fr', '$2a$10$XzsU01QgfNjK0N.432l5/.UKiSISQ0IhY/kfrQzDrIT476HFnCwVe', 'demo18', 'demo18', '2016-05-14 13:23:24', '2016-05-14 13:23:24')  13:23:24 web.1         | [DEBUG]    (0.5ms)  COMMIT  13:23:24 web.1         | [INFO ] method=POST path=/admin format=html controller=active_admin/devise/registrations action=create status=302 duration=257.00 view=0.00 db=21.08 location=http://rails-starter.dev:3000/admin  

My project:

  • Rails 4.2.6
  • ActiveAdmin 1.0.0.pre2
  • Devise 3.5.9
  • Ruby 2.3.0
  • Mac OSX 10.11 (for development)

How do I use CanCan to classify customers after they signed in?

Posted: 14 May 2016 04:35 AM PDT

The below is my class Ability. It means if you are admin you can do everything, else you just can read. But i don't know how to classify customers after they signed in? If you have any suggestion pls help me!

class Ability    include CanCan::Ability      def initialize(user)      user ||= User.new # guest user (not logged in)      if user.admin?        can :manage, :all      else        can :read, :all      end    end  end  

Grouping parameters in form submission

Posted: 14 May 2016 04:42 AM PDT

I have a react form component in rails that has a few fields.

React Component file

var TemplateForm = React.createClass({      render: function () {          return (              <div className="panel">                  <div className="panel-header">                      Create new Template                  </div>                  <div className="panel-content">                      <form entype="multipart/form-data" ref="template_form" action={this.props.baseUrl} acceptCharset="UTF-8" method="post">                          <input name="utf8" type="hidden" value="✓" />                          <input type="hidden" name='authenticity_token' value={this.props.authenticity_token} />                          <ul>                              <li className="item">                                  <label className="f-label field-required">Name</label>                                  <input className="txt-box medium" name="template-name"/>                              </li>                                <li className="item">                                  <label className="f-label field-required">Paper Size</label>                                  <select id ="paper-size" name="paper-size" className="medium" >                                      <option>A4</option>                                      <option>A3</option>                                  </select>                              </li>                              <li className="item">                                  <label className="f-label field-required">Theme</label>                                  <select id ="theme" name="theme" className="medium">                                      <option>Daffodils</option>                                  </select>                              </li>                          </ul>                        </form>                  </div>                  <div className="panel-footer">                      <button className="btn beta-btn" onClick={this.submitForm}>Create Template</button>                  </div>              </div>          );      },      submitForm: function(){          this.refs.template_form.submit();      }  });  

When I submit them I get the following the below parameters in the server console.

{"utf8"=>"✓",   "authenticity_token"=>"some_token",   "template-name"=>"World",   "paper-size"=>"A4",   "theme"=>"Daffodils"}  

How do I group the parameters say I want to separate the utf8 and authenticity_token from the remaining.

Expecting output like

{"utf8"=>"✓",   "authenticity_token"=>"some_token",   "template_info" => {    "template-name"=>"World",     "paper-size"=>"A4",     "theme"=>"Daffodils"  }  }  

Rails not set cookie on API call from emberjs APP

Posted: 14 May 2016 02:37 AM PDT

I send a post request to my API located at http://api.board.app.dev:82/api/private/v1/users/current from my emberjs app located at http://www.app.dev:4200/.

The returned data is saved in localestorage but I also want to save token on cookie.

Actually, I do this :

  cookies[:user] = 1    return { status: 'ok', token: user.authentication_token, email: user.email }  

I see the cookie on the response :

enter image description here

But when I go to http://api.board.app.dev:82/api/private/v1/users/current I never see the cookie in the chrome console.

Any idea ?

rails 4 and paypal custom payment form: Please enter a valid credit card number and type

Posted: 14 May 2016 06:34 AM PDT

I have seen quite a few questions on this error and nothing seems solve my error.

I followed railcasts #145 video. But then I get this error

This transaction cannot be processed. Please enter a valid credit card number and type. error_codes: '10527'

Here is the console log

environments/development.rb

    config.after_initialize do    ActiveMerchant::Billing::Base.mode = :test  ::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(    login: "kkarnam_api1.outlook.com",    password: "NDTFX3DB9RNSPNBP",    signature: "AFcWxV21C7fd0v3bYYYRCpSSRl31AZ2qe636wxoxFrdYfJttOPC6fZ4b"    )   

end

models/order.rb

    class Order < ActiveRecord::Base      belongs_to :series      has_many :transactions, class_name: "OrderTransaction"        attr_accessor :card_number, :card_verification    #4032034846427006        before_create :validate_card      def purchase        # byebug      response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)       transactions.create!(action: "purchase", amount: price_in_cents, response: response)      # cart.update_attribute(:purchased_at, Time.now) if response.success?      response.success?    end      def price_in_cents      (series.rent_price*100).round    end      private    def purchase_options      {        :ip => ip_address,          # :ip => "49.205.123.7",          billing_address: {          name: "Ryan Bates",          address1: "123 Main St.",          city: "New York",          state: "NY",          country: "US",          zip: "10001"        }      }    end      def validate_card      unless credit_card.valid?        credit_card.errors.full_messages.each do |message|          errors.add :base, message        end      end    end      def credit_card      @credit_card ||= ActiveMerchant::Billing::CreditCard.new(        type: card_type,        number: card_number,        verification_value: card_verification,        month: card_expires_on.month,        year: card_expires_on.year,        first_name: first_name,        last_name: last_name      )    end  end  

models/series.rb

    class Series < ActiveRecord::Base      has_many :episodes      has_many :orders    end  

controller/orders_controller.rb

    class OrdersController < ApplicationController      def new      @order = Order.new    end      def create      @series = Series.find(params[:series_id])        @order = Order.new(order_params)      @order.ip_address = "49.205.123.7" #request.remote_ip      @order.series_id = @series.id        if @order.save          if @order.purchase               flash[:notice] = "Series is successfully purchased"              redirect_to [@series,@order]          else                render :new          end      else          render :new      end           end      def show      @order = Order.find(params[:id])    end      private    def order_params      params.require(:order).permit(:first_name, :last_name,:card_type,:card_expires_on )    end        end  

These are the things I tried ...

  1. I read remote.ip_address will be captured as ::1 if I run it on a local machine and it has to be changed, so just to test I hard coded the IP. But then no luck.
  2. Double checked that PayPal buyer account is a business pro account. But then no luck

Paypal account details

Any other regular/possible mistakes that am making?

Any help will be much appreciated. Thanks in advance.

No implicit conversion of nil to hash in application.rb

Posted: 14 May 2016 02:14 AM PDT

This is what my application.rb looks like:

require File.expand_path('../boot', __FILE__)    require 'rails/all'    # Require the gems listed in Gemfile, including any gems  # you've limited to :test, :development, or :production.  Bundler.require(*Rails.groups)    module Ivrs    class Application < Rails::Application      # Settings in config/environments/* take precedence over those specified here.      # Application configuration should go into files in config/initializers      # -- all .rb files in that directory are automatically loaded.        # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.      # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.      # config.time_zone = 'Central Time (US & Canada)'        # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.      # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]      # config.i18n.default_locale = :de        # Do not swallow errors in after_commit/after_rollback callbacks.      # config.active_record.raise_in_transactional_callbacks = true      config.time_zone = 'Mumbai'    end  end  

When I run bundle exec rake -T, I get this error:

TypeError: no implicit conversion of nil into Hash  /Users/sample_app/ivrs/config/application.rb:24:in `<class:Application>'  /Users/sample_app/ivrs/config/application.rb:10:in `<module:Ivrs>'  /Users/sample_app/ivrs/config/application.rb:9:in `<top (required)>'  /Users/sample_app/ivrs/Rakefile:4:in `require'  /Users/sample_app/ivrs/Rakefile:4:in `<top (required)>'  

I cannot resolve this error. Does anyone have ideas?

How to customize the attachment file name in ROR?

Posted: 14 May 2016 01:41 AM PDT

I have a file which returns a pdf attachment as an output. I am using wicked pdf to generate this pdf.

    def generate_pdf          render pdf: "#{@user.name}",                         template: 'api/v1/doctors/get_report_4.html.erb',                         :page_size => 'Letter',                         layout: false, disposition: 'attachment',                         :margin => {bottom: @margin_bottom, top: @margin_top, left: @margin_left, right: @margin_right},                         wkhtmltopdf: %x(bundle exec which wkhtmltopdf).to_s.strip.presence || %x(which wkhtmltopdf).to_s.strip}    end  

But while calling this API. I am getting the attachment with name "response.pdf" instead of username.pdf. Please help me with this.

Why render partial with collection wont work?

Posted: 14 May 2016 01:29 AM PDT

Here is my code: on my index.erb

<tbody>      <tr>          <th>Company</th>      </tr>      <% render partial: :company, collection: @companies %>  </tbody>  

on my _company.erb:

<tr>      <td><%= link_to company.name, company %></td>  </tr>  

It won't show the data on the view.

Zurb Foundation's javascript not working

Posted: 14 May 2016 05:43 AM PDT

Currently working on Rails 4.2.6, installed foundation-rails gem, follow all the instruction. Now it include a bunch of javscript and stylesheet files in application,

application.js

//= require jquery  //= require jquery.turbolinks  //= require jquery_ujs  //= require dataTables/jquery.dataTables  //= require jquery_sortable  //= require foundation  //= require turbolinks  //= require_tree .    $(function(){ $(document).foundation(); });  

but when i try to use some components having javascript in it, it does not work. I tried this drop-down from foundation's docs

<a href="#" class="button" data-dropdown="drop">Link Dropdown &raquo;</a>  <ul id="drop" class="[tiny small medium large content]f-dropdown" data-dropdown-content>    <li><a href="#">This is a link</a></li>    <li><a href="#">This is another</a></li>    <li><a href="#">Yet another</a></li>  </ul>  

It just give me some links without any working drop-down and an error in console

TypeError: Cannot read property 'className' of undefined(…)  (anonymous function)    @   foundation.core.self-f55f82f….js?body=1:197  

Also alert messages are not working properly either,

<div class="row">    <div class="small-6 small-centered columns">      <% flash.each do |name, msg| %>          <% flag = name.to_s == 'notice' ? 'success' : 'alert' %>          <div data-alert class="alert-box <%= flag %> radius">            <strong><%= flag == 'success' ? 'Yay!' : 'Error' %></strong>            - <%= msg %>            <a href="#" class="close">&times;</a>          </div>      <% end %>    </div>  </div>  

It shows an alert box with message but it won't close by clicking on x button or link and for that it don't give any error messages.

How to create ActionController to get items with list of tags

Posted: 14 May 2016 03:33 AM PDT

Database tables, first table contain tags (id, name) the second table contain relation between items and tags.

  tags                 id   name               1   TagA             2   TagB             3   TagC       tags_items              item_id    tag_id            1          1            1          2            1          3            2          1            2          3  

Active reocrds :

  class Tag < ActiveRecord::Base        has_many :tags_itemses          validates_presence_of :name        validates_length_of :name,  :maximum => 15      end        class TagsItems < ActiveRecord::Base        has_many :tags      end  

In my controller i have index method:

def index          items = TagItems.all.includes(:tags)          render json: items,                 status: 200        end  

How the controller should looks like to get following json ?

    [{item_id :1, tags: [{id:1, name: TagA}, {id:2, name: TagB}, {id:3, name: TagC}]},       {item_id :2, tags: [{id:1, name: TagA}, {id:3, name: TagC}]}]  

Rails errors in routing roots

Posted: 14 May 2016 01:47 AM PDT

I am making a simple project controller name posts. My routes has : 1. get 'posts' 2. root 'post#index'

But when I am starting the server it is stopping automatically and giving a bunch of error. But once I comment out the line get 'posts' rails server works properly. why is this happening ?

How to put ruby code inside <div> tags?

Posted: 14 May 2016 12:57 AM PDT

my ruby code inside the div tags are not influenced by what is ordered in div tags. How should I fix them?

      <div class="5u 12u$(xsmall)" align="right">                    </div>        <div class="7u$ 12u$(xsmall)">          <% if devise_mapping.rememberable? -%>            <%= f.check_box :remember_me %>            <%= f.label :remember_me %>          <% end -%>          <%= render "devise/shared/links" %>        </div>  

Rails Active Record - Calling Distict Rows

Posted: 13 May 2016 11:55 PM PDT

I have the following models

influencers (id, name, ..)  influencer_authorizations (id, influencer_id, ... )  influencer_metrics (id, influencer_authorization_id, date, count)  

The relationships are as follows

influencers has_many influencer_authorizations  influencer_authorizations has_many influencer_metrics  

I want to fetch the count of all the influencer_authorizations in the influencer_metrics with the latest DATE and sum to show the total followers of the influencer

What am trying

Finding all the Authorizations IDs

influencer_authorizations = InfluencerAuthorization.where(influencer_id: influencer.id).pluck(:id)  

Now i am trying to find the latest Date's rows all the influencer_authorizations technically for each influencer_authorizations it should give back one row whose sum i want to calculate.

total_followers = InfluencerMetric.where(influencer_authorization_id: influencer_authorizations).order('metrics_date DESC').first  

But it returns all the rows right now. The date is tricky as i each influencer_authorizations last fetched date can be different at times. So we need the lastest metrics records for each influencer_authorizations

Generating a random string to save as an id, but continues to change on every page refresh?

Posted: 13 May 2016 11:34 PM PDT

I am trying to generate a Random 4-5 alphanumeric string to replace a standard user id, i have everything working, except every time I refresh the pages it generates and replaces the String. i have tried before_save and before_create but both seem to not work here.

My Model:

class Admin < ActiveRecord::Base    before_create :admin_ident      devise :database_authenticatable, :registerable,           :recoverable, :rememberable, :trackable,           :validatable, :confirmable, :lockable, :timeoutable           validates_uniqueness_of :admin_ident           def admin_ident           self.admin_ident = SecureRandom.hex(2).upcase         end  end  

My Devise Registration Controller:

class Admin::Admins::RegistrationsController < Devise::RegistrationsController      private      def sign_up_params      params.require(:admin_admin).permit(:email, :password, :password_confirm, :admin_ident, :f_name, :m_name, :l_name, :dob, :street_number, :street_name, :unit_apt,      :quadrant, :city, :province, :postal_code, :home_tel, :moibile_tel, :office_tel, :office_ext, :company_email,      :position, :start_date, :end_date, :quit, :resigned, :terminated_cause, :terminated_wo_cause, :medical_leave,      :leave_of_abscense, :dl_number, :dl_class, :expiry, :conditions, :sl_number, :sl_certs, :issued, :expires, :emc_1_name,      :emc_1_tel, :emc_1_relationship, :emc_2_name, :emc_2_tel, :emc_2_relationship)    end      def account_update_params      params.require(:admin_admin).permit(:email, :password, :password_confirm, :current_password, :admin_ident, :f_name, :m_name, :l_name, :dob, :street_number, :street_name, :unit_apt,      :quadrant, :city, :province, :postal_code, :home_tel, :moibile_tel, :office_tel, :office_ext, :company_email,      :position, :start_date, :end_date, :quit, :resigned, :terminated_cause, :terminated_wo_cause, :medical_leave,      :leave_of_abscense, :dl_number, :dl_class, :expiry, :conditions, :sl_number, :sl_certs, :issued, :expires, :emc_1_name,      :emc_1_tel, :emc_1_relationship, :emc_2_name, :emc_2_tel, :emc_2_relationship)    end      def set_admin       @admin = Admin.find_by_admin_ident(params[:id])    end    end  

My Routes.rb File:

  ## Namespace Resources      namespace :admin do        devise_for :admins, controllers: {          :registrations => 'admin/admins/registrations',          :sessions => 'admin/admins/sessions',          :passwords => 'admin/admins/passwords',          :confirmations => 'admin/admins/confirmations',          :unlocks => 'admin/admins/unlocks'        }        resources :admin_static      end      ## Devise Scopes    devise_scope :admin do      authenticated  do        root to: 'admin/admin_static#home', as: 'admin_authenticated_root'      end    end  

not sure where I am going wrong here.. any assistance would be great!

Edit 1:

I am attempting to edit the admin/admin_static#home page

Nginx, Unicorn, net::ERR_TOO_MANY_REDIRECTS

Posted: 13 May 2016 10:36 PM PDT

When I try to visit my rails app on Digital Ocean Server, I get the following error in the browser: redirected you too many times. In console: net::ERR_TOO_MANY_REDIRECTS

At this point capistrano deploys successfully with no errors. The app runs perfect locally (no errors) there either.

Here are other relevant files below starting with error log files for nginx, unicorn, and rails, and also shown below that the configuration files for nginx and unicorn.

/etc/defaults/unicorn

CONFIGURED=yes  TIMEOUT=60  APP_ROOT=/home/rails/rails_project/current  CONFIG_RB=/etc/unicorn.conf  PID=/var/run/unicorn.pid  RAILS_ENV="production"  UNICORN_OPTS="-D -c $CONFIG_RB -E $RAILS_ENV"  PATH=/home/rails/.rvm/gems/ruby-2.2.2/bin:/home/rails/.rvm/gems/ruby-2.2.2@global/bin$  export GEM_HOME=/home/rails/.rvm/gems/ruby-2.2.2  export GEM_PATH=/home/rails/.rvm/gems/ruby-2.2.2:/home/rails/.rvm/gems/ruby-2.2.2@glo$  export HOME=/home/rails  DAEMON=/home/rails/.rvm/gems/ruby-2.2.2/bin/unicorn  

/var/log/unicorn/unicorn.log

I, [2016-05-13T22:26:59.271424 #11584] INFO -- : reaped #<Process::Status: pid 11587 exit 0> worker=0  I, [2016-05-13T22:26:59.272911 #11584] INFO -- : reaped #<Process::Status: pid 11590 exit 0> worker=1  I, [2016-05-13T22:26:59.273219 #11584] INFO -- : reaped #<Process::Status: pid 11592 exit 0> worker=2  I, [2016-05-13T22:26:59.273573 #11584] INFO -- : reaped #<Process::Status: pid 11595 exit 0> worker=3  I, [2016-05-13T22:26:59.274209 #11584] INFO -- : master complete  I, [2016-05-13T22:27:00.664033 #12489] INFO -- : unlinking existing socket=/var/run/unicorn.sock  I, [2016-05-13T22:27:00.664570 #12489] INFO -- : listening on addr=/var/run/unicorn.sock fd=10  I, [2016-05-13T22:27:00.668023 #12489] INFO -- : worker=0 spawning...  I, [2016-05-13T22:27:00.669161 #12489] INFO -- : worker=1 spawning...  I, [2016-05-13T22:27:00.670383 #12492] INFO -- : worker=0 spawned pid=12492  I, [2016-05-13T22:27:00.671245 #12489] INFO -- : worker=2 spawning...  I, [2016-05-13T22:27:00.676617 #12489] INFO -- : worker=3 spawning...  I, [2016-05-13T22:27:00.680864 #12495] INFO -- : worker=1 spawned pid=12495  I, [2016-05-13T22:27:00.681924 #12489] INFO -- : master process ready  I, [2016-05-13T22:27:00.689107 #12497] INFO -- : worker=2 spawned pid=12497  I, [2016-05-13T22:27:00.696755 #12500] INFO -- : worker=3 spawned pid=12500  I, [2016-05-13T22:27:00.802486 #12492] INFO -- : Refreshing Gem list  I, [2016-05-13T22:27:00.804209 #12500] INFO -- : Refreshing Gem list  I, [2016-05-13T22:27:00.807876 #12497] INFO -- : Refreshing Gem list  I, [2016-05-13T22:27:00.811879 #12495] INFO -- : Refreshing Gem list  I, [2016-05-13T22:27:10.403242 #12500] INFO -- : worker=3 ready  I, [2016-05-13T22:27:10.404469 #12497] INFO -- : worker=2 ready  I, [2016-05-13T22:27:10.406947 #12495] INFO -- : worker=1 ready  I, [2016-05-13T22:27:10.407474 #12492] INFO -- : worker=0 ready  

/var/log/nginx/error.log

2016/05/13 21:00:18 [error] 31654#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"  2016/05/13 21:05:33 [error] 31654#0: *5 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"  2016/05/13 21:19:52 [error] 31654#0: *8 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 180.76.15.29, server: codepajamas.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "www.codepajamas.com"  2016/05/13 21:21:40 [error] 31654#0: *12 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"  2016/05/13 21:30:33 [error] 31654#0: *16 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 148.75.53.23, server: codepajamas.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/run/unicorn.sock/", host: "codepajamas.com"  

/home/rails/rails_project/current/log/production.log

(empty)  

/etc/unicorn.conf

listen "unix:/var/run/unicorn.sock"  worker_processes 4  user "rails"  working_directory "/home/rails/rails_project/current"  pid "/var/run/unicorn.pid"  stderr_path "/var/log/unicorn/unicorn.log"  stdout_path "/var/log/unicorn/unicorn.log"  

/etc/nginx/nginx.conf

user www-data;  worker_processes 4;  pid /run/nginx.pid;    events {    worker_connections 768;  }    http {    sendfile on;    tcp_nopush on;    tcp_nodelay on;    keepalive_timeout 65;    types_hash_max_size 2048;      include /etc/nginx/mime.types;    default_type application/octet-stream;      access_log /var/log/nginx/access.log;    error_log /var/log/nginx/error.log;      gzip on;    gzip_disable "msie6";      text/xml application/xml application/xml+rss text/javascript;      include /etc/nginx/conf.d/*.conf;    include /etc/nginx/sites-enabled/*;  }  

/etc/nginx/sites-available/rails

upstream app_server {    server unix:/var/run/unicorn.sock fail_timeout=0;  }    server {    listen 443 ssl;    server_name <mydomain>.com www.<mydomain>.com;    ssl_certificate /etc/letsencrypt/live/<mydomain>.com/fullchain.pem;    ssl_certificate_key /etc/letsencrypt/live/<mydomain>.com/privkey.pem;    root /home/rails/rails_project/current/public;    index index.htm index.html;      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    ssl_prefer_server_ciphers on;    ssl_dhparam /etc/ssl/certs/dhparam.pem;    ssl_ciphers <removed don't want you to see>    ssl_session_timeout 1d;    ssl_session_cache shared:SSL:50m;    ssl_stapling on;    ssl_stapling_verify on;    add_header Strict-Transport-Security max-age=15768000;      location / {      try_files $uri/index.html $uri.html $uri @app;    }      location ~* ^.+\.  (jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {  try_files $uri @app;    }      location @app {      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;      proxy_set_header Host $http_host;      proxy_redirect off;      proxy_pass http://app_server;    }      location ~ /.well-known {      allow all;      root /usr/share/nginx/html;    }  }    server {    # redirect HTTP to HTTPS    listen 80;    server_name <mydomain>.com www.<mydomain>.com;    return 301 https://$host$request_uri;  }  

Any help is much appreciated.

Ruby on rails, NoMethodError: undefined method `include' for #<#<Class: on all tests

Posted: 13 May 2016 10:32 PM PDT

Every test returns an error status with the following message:

NoMethodError: undefined method `include' for #<#<Class:0x60fd1e8>:0x60fd158>  

Every test of every module fails in this way, however the application runs as expected, without issue

The tests run on one computer, but not the other (Windows 7 and 10, respectively)

Ruby/Rails versions:

ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]  Rails 4.2.5.1  

Here is a minimal test that has the issue:

test "passes" do    assert true  end  

Which returns:

SessionControllerTest#test_passes:  NoMethodError: undefined method `include' for #<#<Class:0x45b5c20>:0x45b5a28>  

Here's a full stack trace:

NoMethodError: undefined method `include' for #<#<Class:0x5cd6810>:0x5cd6768>      (erb):7:in `get_binding'      C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval'      C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result'      activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:42:in `render'      activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:33:in `rows'      activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:24:in `each'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:760:in `block (2 levels) in read_fixture_files'      activerecord (4.2.5.1) lib/active_record/fixture_set/file.rb:15:in `open'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:759:in `block in read_fixture_files'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `each'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `each_with_object'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:758:in `read_fixture_files'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:590:in `initialize'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:514:in `new'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:511:in `map'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:511:in `block in create_fixtures'      activerecord (4.2.5.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:288:in `disable_referential_integrity'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:508:in `create_fixtures'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:979:in `load_fixtures'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:941:in `setup_fixtures'      activerecord (4.2.5.1) lib/active_record/fixtures.rb:826:in `before_setup'      minitest (5.8.4) lib/minitest/test.rb:106:in `block (3 levels) in run'      minitest (5.8.4) lib/minitest/test.rb:205:in `capture_exceptions'      minitest (5.8.4) lib/minitest/test.rb:105:in `block (2 levels) in run'      minitest (5.8.4) lib/minitest/test.rb:256:in `time_it'      minitest (5.8.4) lib/minitest/test.rb:104:in `block in run'      minitest (5.8.4) lib/minitest.rb:331:in `on_signal'      minitest (5.8.4) lib/minitest/test.rb:276:in `with_info_handler'      minitest (5.8.4) lib/minitest/test.rb:103:in `run'      minitest (5.8.4) lib/minitest.rb:778:in `run_one_method'      minitest (5.8.4) lib/minitest.rb:305:in `run_one_method'      minitest (5.8.4) lib/minitest.rb:293:in `block (2 levels) in run'      minitest (5.8.4) lib/minitest.rb:292:in `each'      minitest (5.8.4) lib/minitest.rb:292:in `block in run'      minitest (5.8.4) lib/minitest.rb:331:in `on_signal'      minitest (5.8.4) lib/minitest.rb:318:in `with_info_handler'      minitest (5.8.4) lib/minitest.rb:291:in `run'      minitest (5.8.4) lib/minitest.rb:152:in `block in __run'      minitest (5.8.4) lib/minitest.rb:152:in `map'      minitest (5.8.4) lib/minitest.rb:152:in `__run'      minitest (5.8.4) lib/minitest.rb:129:in `run'      minitest (5.8.4) lib/minitest.rb:56:in `block in autorun'  

No comments:

Post a Comment