Categories
Development Ruby

how do I add comment feature in my app ruby on rails?

I can not add the comment system in my rails app. I followed the rails guide see rails guide started and even started in a new rails app. But I’m not sure I followed the guide correctly. Please help me figure out what I’m doing wrong. CourseController class CoursesController < ApplicationController before_action :authenticate_user! before_action :set_course, […]

Categories
Development Ruby XML

Ruby: How to map a model on XML

In Ruby-on-Rails 6.0, I want to create a Resource named services, with the model, view and controller. Each service has an ID, a Name, a Type and an ImageIndex But I want the model maps on XML (see below) instead of ActiveRecord. And I want that the actions (index, show, new, edit and destroy) modify […]

Categories
Development Docker Ruby System & Network

When should and shouldn’t I use Docker?

I have been reading up about Docker for a while now. I understand it’s an OS & binaries virtualization software on a high level. I am not really able to quite understand when I cannot do without Docker and when I should definitely NOT be using Docker. I am working on a Ruby on Rails […]

Categories
Cache Development GitHub Ruby

How to build and install yugabyte db from github source?

a) downloaded yugabyte-master.zip from github b) created directory /opt/yugabyte/yugabyte-2.0.6.0 c) extracted to /opt/yugabyte d) made /opt/yugabyte/yugabyte-master as present working directory e) run ./configure –prefix “/opt/yugabyte/yugabyte-2.0.6.0” && make && make install but getting error: bash:./configure: No such file or directory Update1: using yb_build.sh: Prerequisites: [root@srvr0 ~]# rpm -qa | grep python libsemanage-python-2.5-14.el7.x86_64 python-gobject-3.22.0-1.el7_4.1.x86_64 python2-ipalib-4.6.4-10.el7.centos.noarch python-schedutils-0.4-6.el7.x86_64 plasma-scriptengine-python-4.11.19-12.el7.x86_64 […]

Categories
Development Drivers Ruby

Ruby Selenium – warning that :driver_path is deprecated

Using Ruby selenium-webdriver 3.142.6 My tests work, but at the start of the run it displays the warning WARN Selenium [DEPRECATION] :driver_path is deprecated. Use :service with an instance of Selenium::WebDriver::Service instead. According to Ruby docs Selenium::WebDriver::Service is a private API. Searching the web for articles related to the warning has references to Capybara, RoR, […]

Categories
Development Ruby

weird undefined method [] but when debugging there is no errors

I’ve defined this method on ruby ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14] and (Rails 4.2.5.2) def log_method_backtrace backtrace = [] (4..8).map do |i| # 4 because before is … map, log_method_backtrace… b = caller[i][/\/(?:.(?!\/))+$/] b = b[1..-2] # *This is the error line b = b.sub(‘:in `’, ‘#’) backtrace << “#{b} <- ” end log […]

Categories
Database Development Ruby

Database modeling best practice: Dealing with Associations to the same “base”

I tried to normalize my database model. But I’m clueless how to do it in this case. Giving the following model: Customer has many Systems (has_many :systems) Cluster has many Systems (has_and_belongs_to_many :systems) I want to display all Systems of a Customer. That would be: @customer.systemobjects.each. That is already working. Then I could add a […]

Categories
Development Linux Ruby

Ctrl-Backspace in vim broken after upgrade

Under FreeBSD’s xterm the following setting made vim delete the last word after pressing ctrl+← (“Control+Backspace”): set backspace=indent,eol,start inoremap <C-?> <C-W> cnoremap <C-?> <C-W> For whatever reason after the last system upgrade this does not work anymore. Instead it results in vim inserting ^? into the document. It works as expected if vim is used […]

Categories
Development Ruby

Is there an identity function in Ruby?

I’m currently writing a Ruby class that provides a menu of base lambdas that can be mixed-and-matched to create a new set of lambdas. (it’s an evolutionary algorithm that requires a lot of customizing of the fitness function depending on the dataset) The configuration fire where this happens it full of stuff like this function_from_modifier.(base_function, […]

Categories
Development Ruby

Why can’t I display my ruby on rails app on localhost?

I’m trying to display a very simple app from codecademy and this is the error I’m getting in my browser: PagesController#welcome is missing a template for request formats: text/html NOTE! Unless told otherwise, Rails expects an action to render a template with the same name, contained in a folder named after its controller. If this […]