Search Posts

Category: ruby-on-rails

How do i track view count of different div blocks on single page while scrolling without clicking them

I have many cards (div blocks) in my single page application. I want to track view counts when the user scrolls through this page. Means whenever one card visible on screen or in screen viewport area while scrolling just increments view count for that particular card (div blocks). It’s like Facebook tracking pixel thing but I want to create custom and different tracking pixel for my cards which track view counts when div is visible. […]

Remove Blank option on Angular on dynamic option objects

I have this code <select ng-model=’’ > <option ng-if=’ == false’ ng-show=’’ ng-repeat=’choice in’ value=”{{}}” ng-disabled=”$parent.controllerAction == ‘show'”>{{}}</option> </select> It shows the 3 choices entered by the Admin of the system in a dropdown box. It shows it without the blank choice. The problem is if I want to put a default value (for example, choice[0]), it adds a blank value. Also when converting from ng-repeat to ng-options from this question. I have 4 […]

Not able to access right node_modules path on webpack-rails

I am trying for the first time to work with angularjs with rails as the back end. I am using webpack-rails gem for the webpack configuration for managing css and other style sheets. First I made a sample angular + rails app to display a simple text “Hello world”. By default the font was in times new roman. Then I added bootstrap to the package.json file as follows. package.json { “name”: “shine”, “version”: “0.0.1”, “license”: […]

webpackMissingModule application.js on rails with angular app

I am following the steps like given by the author. Following is the package.json { “name”: “shine”, “version”: “0.0.1”, “license”: “MIT”, “dependencies”: { “stats-webpack-plugin”: “^0.4.3”, “webpack”: “^1.14.0”, “webpack-dev-server”: “^1.16.2”, “css-loader”: “^0.23.1”, “file-loader”: “^0.9.0”, “style-loader”: “^0.13.1”, “url-loader”: “^0.5.7”, “bootstrap”: “3.3.7” } } I am trying to change the default font to a different font by requiring the bootstrap. My application.js looks like this require(“bootstrap/dist/css/bootstrap.css”); console.log(“Hello world!”); And then I restarted the server. I see the text […]

Record capybara headless chrome tests

I’m using Headless Chrome to run my Capybara tests for an AngularJS 1.5/Rails 3.2 application. How do I record the tests into a video format? I found this very useful when using the headless gem but now I’ve changed to headless chrome I cannot use the headless gem. Here is my setup of headless chrome; Capybara.register_driver(:headless_chrome) do |app| caps = chromeOptions: { prefs: { ‘download.default_directory’ => “#{Rails.root}/tmp/downloads”, ‘download.directory_upgrade’ => true, ‘download.prompt_for_download’ => false, ‘plugins.plugins_disabled’ […]

Rails angularjs : Not accessin the dabatabase

My Angular controller is not accessing the database. I am working with the action ‘index’ for testing purposes. It does display the angular view but with no information. I am manually typing: localhost:3000/tickets/index to test if it works. I have a small personal project, which I developed in rails. Now I am trying to gradually change the front-end to Angularjs. I have a model $ controller working on Rails “PrintingTicket”. Because I don’t want to […]

angularjs how to put array in my url

im getting multiple month in my url here my problem i get of object instead of a name of the months that i choose as you can see in my url i got object months=%5Bobject%20Object%5D i want to see like this months = [mar, apr] here my view in that particular combobox md-input-container flex=”” label Months md-select ng-model=”params.months[month]” multiple=”true” md-option ng-repeat=”month in ctrl.months ” ng-value=”month” | {{month}} here my controller #= require ./../../module class IncomeStatementIndexCtrl […]

Rails Submit Buttons Not working (name="commit")

I have a Rails 5 application using only AngularJS, no jQuery/Turbolinks. Typical submit buttons generated by form helper do not work in this application (go immediately to disabled) without submitting the form, and I’ve resorted to using button_tags with type=”Submit” instead. If I remove the “name=’commit’” atribute from the submit button, it works as expected by submittin the form. I’m wondering if there’s something bound to this attribute that I’m not seeing. Below is an […]

Multiple Angular requests cause errors within tests

I’ve got an Angular 1.5 app with a Rails 4.0 backend and I’ve got this problem where in my tests once a Staff member logs in 3 queries are sent to the backend at the same time. In testing (using Capybara + selenium + chromeheadless) this causes these requests result in errors on the backend. In development it works fine. An example of the error; NoMethodError at /entities/get_current_entity ============================================= > undefined method `fields’ for nil:NilClass […]

Next Page »