Ruby on rails

Rstudio Server equivalent for Python

I am currently running RStudio Server on an AWS EC2 ubuntu instance and am enjoying editing my files directly on the server via the web interface. I was wondering if there are any other IDE’s that have this ability (to run on a server and have their GUI accessible via web browser), specifically for Python / Ruby. Source: ruby

Need better regex solution in Ruby

I have following code: date_time = Time.now.strftime(‘%Y%m%d%H%M%S’) name = “builder-#{date_time}” # builder-20150923125450 if some_condition name.sub!(“#{date_time}”, “one-#{date_time}”) # builder-one-20150923125450 end Above code is working fine. But I think it can be optimized as I feel like I am repeating #{date_time} twice here. I have heard of regex capture and replace. Can we use it here? If yes, how? Source: ruby

Artifactory AQL post over ruby

I’m trying to query the Artifactory’s AQL API using ruby code, I already checked that this code works on bash using curl: curl -u admin:password -i -H “Accept: application/json” -X POST http://server.example.com:8081/artifactory/api/search/aql -T aql.aql Where aql.aql contents are as follows: items.find ( { “repo”:{“$eq”:”test-ASO”} } ) .include(“name”,”property.*”) Now I’m trying to do the same using Ruby with this code: #!/usr/bin/ruby…
Read more

Association Issue

I have 3 models User, Club and Mcq. In club model. I assign club (class) as – 9-physics 9-chemistry 10-physics 10-chemistry… Here is my Association class User < ActiveRecord::Base has_and_belongs_to_many :clubs end class Club < ActiveRecord::Base has_many :mcqs has_and_belongs_to_many :users end class Mcq < ActiveRecord::Base belongs_to :club end In my student view (student show index) I show all club (as…
Read more

Error when running Jekyll: cannot load such file — google/api_client (LoadError)

I had to reinstall OS X Yosemite 10.10.5 and now I get the following error when running my Jekyll site (previously it was working fine): MacBook-Pro-Svetlana:iloveip svetlana$ jekyll serve WARN: Unresolved specs during Gem::Specification.reset: pygments.rb (~> 0.6.0) redcarpet (~> 3.1) jekyll-watch (~> 1.1) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. Configuration file: /Users/svetlana/Desktop/iloveip/_config.yml /Users/svetlana/Desktop/iloveip/_plugins/page_view.rb:4:in…
Read more

Rails missing parameters id=> nil

In my ruby on rails application i’ve got a partial called _cart.html.erb <h2>Your Cart</h2> <table> <%= render(cart.line_items) %> <tr class=”total_line”> <td colspan=”2″>Total</td> <td class=”total_cell”><%= number_to_currency(cart.total_price) %></td> </tr> </table> <%= button_to ‘Checkout’, new_order_path, method: :get %> <%= button_to ‘Empty cart’, cart, method: :delete, data: { confirm: ‘Are you sure?’ } %> if a cart have one or more line_items i can…
Read more

FooTable doesn’t work in ruby on rails project

I’m trying to using FooTable in a ruby on rails project (I’ve never used FooTable before) but I can’t make it work. I’ve inserted gem ‘footable-on-rails’ in my gemfile (and ran bundle install) I’ve inserted footable.js in app/vendor/assets/javascript and also in app/assets/javascript (which is the best/right location?) I’ve inserted footable.core.css in app/vendor/assets/stylesheet and also in app/assets/stylesheet I’ve created this file…
Read more

How to get ruby real version?

As I know, ruby -e ‘puts RUBY_VERSION’ will print out ruby version. In Ubuntu 14.04, they will print 1.9.3 but its libraries path is /usr/lib/ruby/1.9.1 Why are they different? How can I get the latter one? Source: ruby