ruby-on-rails,ruby,ruby-on-rails-3,devise,gem
Have you updated your OSX recently? Maybe you need to update your xcode/xcode tools and then reinstall postgres. Have you installed postgres by homebrew? If yes, try to reinstall running brew uninstall postgresql and then brew install postgresql Then, try again to run "bundle install"....
I found this discussion: https://www.ruby-forum.com/topic/131346 Obviously calling Gem.clear_paths solves the issue. In total: begin require 'progressbar' rescue LoadError => e puts "exception .. installing with gem" h = system 'gem install progressbar' puts "gem installed #{h}" Gem.clear_paths require 'progressbar' end pbar = ProgressBar.new("test", 100) 100.times {sleep(0.1); pbar.inc}; pbar.finish ...
mysql,ruby,windows-7,gem,rubygems
The 'mysql' and 'mysql2' packages/extensions/gems don't work with the x64 bit version of Ruby on Windows 7 (or any 64 bit version of Windows). You need to install the x86 (32) bit version of Ruby for them to work. So I repeated step 3 in my question, and installed...
Check if your rake task has the following format: namespace :your_namespace do desc 'Description for rake task' task generate_secret_token: :environment do end end While running rake task, run as 'rake namespace:generate_secret_token'...
ruby-on-rails,ruby-on-rails-4,methods,gem
Try rewriting it to this instead: <% Shoppe::ProductCategory.all.each do |prod| %> <li><%= prod.name %></li> <% end %> You need to call all on the Shoppe::ProductCategory to be able to iterate over the collection. Hope it helps!...
ruby-on-rails,gem,user-accounts
I don't think there is a gem to do that, but it should be pretty simple to code: Add remaining_visits to your User model and table. Do current_user.update(remaining_visits: current_user.remaining_visits+10) when a ticket is purchased. Copy Devise sessions controller into app/controllers/devise/sessions_controller.rb. Inside this controller, add this kind of code to create...
Fortunately, rails has a gem for this called rails4-autocomplete. Here is the link https://github.com/peterwillcn/rails4-autocomplete This helps for JQuery's autocomplete....
Looks like you're missing required C libraries. At a guess I'd say you need to install libxml2-dev (or whatever it's called in your flavour of Linux's package manager).
ruby-on-rails,ruby,gem,install
sudo chmod 777 directory_name It grants all permissions to the user....
Found the answer, the system rubygems.rb was referencing the wrong version of Ruby. More details here: https://github.com/Homebrew/homebrew/issues/31220
With a .gem file you can run gem install --force --local GEM_NAME.gem Without a .gem file, you can build your gem with a gemspec: gem build GEM_NAME.gemspec If you don't have a gemspec file, then write one or use bundler to maintain one Your .gem file is just an archived...
ruby-on-rails,ruby,gem,sinatra
You require 'sinatra/namespace' before you require books.rb, but you only register Sinatra::Namespace in the GuessApp app after you require it. Requiring alone only makes it available in classic style apps. You need to make sure Sinatra::Namespace is registered in GuessApp before you try to use namespace, something like this in...
ruby-on-rails,ruby-on-rails-4,gem,like
You can already test in your console to see how it works first: rails c user = User.first post = Post.first user.like!(post) user.likes?(post) So you can create an action: likes in your Posts controller. def likes @user = current_user # before_action :authenticate_user, only: [:likes] @post = Post.find(params[:id]) @user.like!(@post) redirect_to :back,...
ruby-on-rails,gem,bundler,circleci
The solution is simple: CircleCI runs some commands by default and caches gems also by default in vendor/bundle, so there is no need to add anything to cache_directories. Among those default commands is bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3, that checks presence of gems in the cache...
ruby-on-rails,ruby,gem,factory-girl,rspec3
Dir[] provides no guarantee about the ordering - results will in general by file system dependant. It could be alphabetical it could be the raw unicode binary ordering, or some order that corresponds to some internal data structure. If you want things returned in a specific order the it's up...
The "#!" line at the start of a script tells your shell which executable to execute the script with. In this case, it tells it to find the Ruby executable from the environment and give the script to it for execution. By means of example, I have a file called...
ruby,ubuntu,gem,install,nokogiri
I tried the following commands and I've got it. Thanks to Mr.Kumar $ sudo apt-get update $ sudo apt-get install libxml2-dev $ sudo apt-get install libxslt-dev $ sudo gem install nokogiri -v '1.4.7' $ gem list nokogiri *** LOCAL GEMS *** nokogiri (1.4.7) ...
ruby-on-rails,ruby,gem,rubygems,byebug
I had downgrade to a lower version of byebug and it works. Not sure what incompatibilities there may have been with the latest version. Using 3.5.1 worked for me. gem 'byebug', '~> 3.5.1' ...
ruby-on-rails,gem,activemessaging
As the message suggests, the problem is caused by the infinite loop dependency, e.g. activemessaging depends on itself. Check the gem spec in activemessaging to see if there is a self dependency defined.
From the command line you can see if a gem is installed with gem list <gemname>. This prints out a list of installed gems that match <gemname>: $ gem list sass *** LOCAL GEMS *** sass (3.4.13, 3.4.1, 3.2.19) sass-rails (5.0.1, 4.0.3) The argument is actually a regex, so you...
Is it when you run tests that's using a test environment even if you didn't explicitly create one? $ rails console test brings you to the test environment...
gem install aws-sdk -v 2.0.42 works for me. Can you specify your system configuration?. I have had similar issues with ruby versions in past for mac os, so just confirming...
Bundler uses rubygems, which, when not given a specific version, defaults to the last version marked 'stable', which, if the tag isn't maintained, can mean even terribly deprecated builds.
I don't know if you intend this to be public facing or not, but this seems like a pretty basic application specific task. I would start from scratch on it. If you're looking for a more general gem that can help you manage models in a generic way, you can...
ruby-on-rails,git,github,gem,bundler
Gemfile.lock should know what gem to load, when you do bundle update or installing a new gem, Gemfile.lock will be updated too with new gems, paths, etc.. and also the revision hash. The hash at the end of the Fetch/Push URL that you see when you run git remote show...
ruby-on-rails,ruby,gem,bundler,rbenv
You answer is in the first log: Couldn't find CUPS libraries on your system. Check they're installed and in your path. If you see the gem source here, that message appears when the gem builder is checking for the dependencies. And according to the gem's documentation you need to install...
I think this is the proper way to load a Rails app (found in config.ru): require ::File.expand_path('../config/environment', __FILE__). In fact you can copy and paste that into a regular irb session to turn it into a 'rails console' session. So the key seems to be to require your config/environment and...
ruby-on-rails,ruby,gem,elastic-beanstalk
Alright, figured it out. So, my code compiled to a .bundle file, but that's an OSX specific file. What I actually needed to do was include all my .h and .c files in the gemspec, then build the gem. Then, when installing the gem, those files would be built (which...
shell,powershell,cmd,gem,appveyor
By using powershell to run the command you can use error redirection to check if the command was successful: $gemPath = gem which example3 2>$null if ($gemPath) { # We got a path for the gem driver } else { # Failed, gem might not be installed } Explanation: We're...
ruby-on-rails,ruby-on-rails-4,gem
You want to use the money gem. I just got done writing a financial application and it's the way to go....
Try running bundle env to verify that the install location is what you expect. If not, check whether there is a .bundle/config or ~/.bundle/config file overriding the install path. The output of bundle env will tell you what configuration it is using and how it was determined (i.e., which file...
ruby-on-rails,heroku,gem,bundler,diaspora
You skipped part of the installation instructions, namely: We need to switch the Gemfile.lock to PostgreSQL. Edit Gemfile and change ENV['DB'] ||= 'mysql' to ENV['DB'] ||= 'postgres'. Then run: bundle --without development test heroku production assets git add Gemfile Gemfile.lock git commit -m "switch Gemfile.lock to pg exclusivly" ...
ruby-on-rails,ruby,sass,gem,sprockets
Okay so here goes: I've found the problem and it was solved by actually supplying a version that works with rails 4.2. The default gem compass-rails installs a version incompatible with sprockets. When I added the specific version as seen here and ran another bundle the versions of most of...
If you are developing a new gem, then you'll want to declare all of your production-ready gems in the .gemspec using add_dependency. As for the Gemfile itself, as the comment states, it is used for adding dependencies which are still in development (i.e. not released). For example, if you want...
ruby-on-rails,ruby,gem,rubygems
Ok I figured this out, @ChrisHeald's answer was close to correct, but a small detail was messing this up, here's what worked for me module LocalInstanceMethods def self.included(klass) define_method "other_#{klass.name.underscore.pluralize}" do end end end The part class < klass was messing up the self and klass variables together, without it...
If you are talking about some front-end of a site without any API access or sophisticated JS logic, you could simply use mechanize gem which allows you to do something like: require 'rubygems' require 'mechanize' agent = Mechanize.new page = agent.get('http://google.com/') form = page.forms.first form['field_name_1'] = input1 form['field_name_2'] = input2...
ruby-on-rails,ruby,authentication,gem,sorcery
That's actually a very weird error if the above is really your code. You should have gotten something like Couldn't find Bar with 'id'= instead. The error above is usually only given if you provide no args to find at all, ie. User.find() Anyway, the underlying problem here is that...
module MyModule class << self def included(base) base.extend ClassMethods # what would this be for? end <...> end <...> end This is actually a pretty common practice in Ruby. Basically, what it's saying is: when some object performs include MyModule, make it also extend MyModule::ClassMethods. Such a feat is useful...
ruby-on-rails,ruby,gem,rvm,bundler
I solved it with: sudo apt-get install libmysqlclient-dev sudo apt-get install libpq-dev sudo apt-get install libsqlite3-dev sudo apt-get install libev-dev rvm use 2.0.0 Reboot pc If I run rails -v shows me: Rails 3.2.17 And now I can make Bundle install I think the rails version was in conflict. I...
Try by downloading an older version of Ruby as sometimes new versions are not packaged with everything. I would also try to use a compiler app such as Koala. if you only want to try sass out.
ruby-on-rails,controller,gem,destroy
On wicked wizards there are path helpers available on views that don't show on rake routes. Try redirect_to wizard_path(:picture) You can find more information about wicked helpers available to views here: https://github.com/schneems/wicked#quick-reference These helpers will be available on views rendered using render_wizard. Outside of the wizard, the step is passed...
Your gem should have a lib directory. During development, you will need to get that lib directory added to Ruby's load path one way or another. You can add it in Ruby code. I wouldn't recommend doing that in your situation, but it is helpful to put something like this...
ruby-on-rails,ruby,gem,rubygems
I was being too strict with the gem dependency. It needed to be: s.add_dependency 'responders', '~> 2.0' ...
You are probably using the beta version of the net-ssh gem. You need to install version net-ssh (2.9.2), and remove 2.9.3-beta1. You can see what version of the net-ssh gem you are using with the following command: gem list net-ssh The results should look like this: $gem list net-ssh ***...
ruby-on-rails,ruby,regex,string,gem
The approach I took is as follows: Divide the string into an array of words. If the array contains fewer than two words, return an array containing all the date strings found; else go to step 3. If the array contains at least three words and the first three words...
it seems like you are missing a , between the gem name and the version in the gemspec: spec.add_runtime_dependency("rwanda", "~> 0.6.0") ...
You can use pipe your output to awk like this: gem environment | awk -F ' *: *' '$1 ~ /EXECUTABLE DIRECTORY/{print $2}' /var/lib/gems/1.8/bin ...
You need to add all the files that need be included with the gem in spec.files. You missed to add the files that you have in the bin directory. For example, I have the following configuration from one of my gems: Gem::Specification.new do |spec| spec.files = Dir["{bin,lib}/**/*", "LICENSE", "README.md"] spec.test_files...
Just run bundle update without telling to update just a specific gem (like rails). This allows bundler to find the lastest possible compination for all gems in the Gemfile. The prototype-rails gem is not activily supported anymore. You should try to replace it as soon as possible (even if the...
ruby-on-rails,ruby,file,gem,will-paginate
If I understand correctly, your Application.js has this line: //= require will_paginate When the app launches it looks for the listed JavaScript files/libraries to be available. will_paginate.js doesn't exist, so app errors out on load. "will_paginate" is a gem, so I think rubykid is right--bundle all. The next step is...
Ok, I managed to reproduce the problem. He ran rails generate devise install without the colon. Which generated a model and a route entry for 'Install'. You can see the model being used in the stack trace. To fix this delete this file: /Users/joshuadavid/stukwork/estuk/app/models/install.rb Then open up your routes (config/routes.rb)...
ruby-on-rails,ruby,gem,bundler
I delete the Gemfile.lock, then run bundle install. Everything is ok! :)
Basically, it's because require method loads files by name from paths listed in $: or $LOAD_PATH "If the filename does not resolve to an absolute path, it will be searched for in the directories listed in $LOAD_PATH ($:)." http://ruby-doc.org/core-2.2.2/Kernel.html#method-i-require If you want to require a gem from the "local" path...
You aren't keeping any references to the objects, so Ruby is garbage-collecting them. Also, don't use ObjectSpace to find your items, it's mainly for debug and introspection tasks. I would alter lib/devices.rb to use a Ruby constant, like this class USBSK ALL_DEVICES = [ self.new(1), self.new(1), self.new(1, '192.168.1.127') ] end...
Take a look at ffi-compiler. There's an example on the gem's page: Example Directory layout lib |- example |- example.rb ext |- example.c |- Rakefile example.gemspec lib/example/example.rb require 'ffi' require 'ffi-compiler/loader' module Example extend FFI::Library ffi_lib FFI::Compiler::Loader.find('example') # example function which takes no parameters and returns long attach_function :example,...
ruby,excel,postgresql,gem,spreadsheet
@engineersmnky comment and this post helped me figure it out. How to convert MS excel date from float to date format in Ruby? require 'date' require 'active_support/time' puts (DateTime.new(1899,12,30) + 42153.days).strftime("%Y-%m-%d") puts (Time.at( (42153 - 25569).days ).utc).strftime("%Y-%m-%d") Either of these solutions work. Basically excel stores dates as doubles and you...
ruby-on-rails,ruby,devise,gem,rubygems
See http://bundler.io/v1.5/git.html Bundler also allows you to work against a git repository locally instead of using the remote version. This can be achieved by setting up a local override: bundle config local.GEM_NAME /path/to/local/git/repository Also http://ryanbigg.com/2013/08/bundler-local-paths/ "There's a little known feature of Bundler that allows you to use a local Git...
Fixed by using ALLOC_N instead of malloc. http://clalance.blogspot.com/2011/01/writing-ruby-extensions-in-c-part-12.html was helpful, though it says malloc should work.
ruby-on-rails,ruby,dependency-injection,gem
Put your configuration in the environment, as you're probably already doing. For example, I use the dotenv gem. Set an environment variable to your adapter gem name. The result is an ENV var that Rails can access, such as: ENV["adapter"] #=> "my_custom_gem_name" Use the environment to pick the adapter, e.g....
It is very common to run with SQLite in development and test and a different database like PostgreSQL in production. Rails makes it easy to do this. In your Gemfile, you can use groups to specify which gems should be installed in each environment. So, in this scenario, your gemfile...
ruby-on-rails,gem,instagram-api,cron-task
We can fetch users media if we have his instagram id and just pass app client_id in request method
ruby,http,asynchronous,gem,eventmachine
Based on my tests, MRI does support nonblocking HTTP requests simply by using a thread. Threads don't always allow parallelism in Ruby due to the GIL, but net/http appears to be one of the exceptions: require 'net/http' require 'benchmark' uri = URI('http://stackoverflow.com/questions/30899019/') n = 10 Benchmark.bm do |b| b.report {...
There is one: cookiecutter-pypackage By the way, I think you should do it by hand at first so you can have a better understanding about how to creat a python package. When you're familiar with it, you can use tools to make this task automatically. Further reading: The official package...
ruby-on-rails,ruby-on-rails-4,gem
You should use the I18n localize helper (it has a short alias l): <%= l diary.created_at, format: :long %> You can also specify the format explicitly: <%= l diary.created_at, format: "%e %b %Y" %> http://apidock.com/rails/ActionView/Helpers/TranslationHelper/localize...
ruby-on-rails,twitter-bootstrap,gem,sass
Try to do the following things for investigate problem: 1) Shutdown Rails app, clear cache (use rake tmp:clear), change color variable and run application again. 2) Try to broke bootstrap-variables.scss file. If your application really using(compile) it you will see a error. 3) Try to change any other variable. Probably...
number_to_human is very close to what you're asking for. It rounds up and down, so 410589 would become "411 K", not sure if that's ok. You'll need either some I18n mappings, or provide a hash of units to get your suffixes, and a little tweaking to get the precision you...
Try gem pristine --all Then bundle install In the terminal of project folder...
ruby-on-rails,installation,gem
Since Ruby 2.0.0 deprecated DL to move towards fiddle movement. Your best answer can be found here to get rid of the warning message that I also encountered a while ago. Good luck!
ruby-on-rails,ruby,gem,compass
mkmf.rb can't find header files for ruby at You need the ruby dev headers files to compile gems. You need the package ruby2.1-dev. You may also need other packages like build-essential. Try the following: sudo apt-get install ruby2.1-dev build-essential ...
ruby-on-rails-4,gem,rails-generators
I was able to figure out that my problem was related to my gemspec file. Specifically with the spec.file assignment. I changed: spec.file = `git ls-files -z`.split("\x0") to spec.file = Dir["{lib,vendor}/**/*"] which resolved my issues....
To build a site like airbnb , you will need 2 set of users . Let's say renters and buyers . You can create different users using devise . Devise provides a lot of in built goodies that would help you get up and started easily . Next you would...
Look at where it fails (which was hard to work out because your newlines got swallowed somewhere): checking for ImageMagick version >= 6.4.9... * extconf.rb failed * This check didn't get a "yes", which suggests that the libmagickwand-dev package you installed did not provide a version of ImageMagic >= 6.4.9...
ruby-on-rails,database,gem,rails-migrations
Create a migration: bundle exec rails g migration remove_attachinary Then tell Rails what to do: def up drop_table :attachinary_files end Remove the change method present by default If ever you'd like this migration to be reversible, copy your previous code in a down method...
You can create a thread in the official ruby forums, also forums/blogs that post about Ruby, and any website that's related to the gem you made. Honestly I don't think you need to advertise the gem much, usually when I want to search for a gem I just put whatever...
ruby-on-rails,gem,rubygems,bundler
The problem is a mismatch between the gem name and the file inside the gem. Because the gem is named 'actionform', Bundler will try to require 'actionform', however the file is actually called action_form. You can tell Bundler the right file name with this syntax: gem 'actionform', :github => 'rails/actionform',...
Add the following to your Polls Controller- def new @poll = Poll.new 4.times do @poll.answers.build end end ...
Yes there most certainly is. You will just want to include that line of code in the install method of said generator. (In below example MyEngine and myengine represent the name of your engine) class InstallGenerator < Rails::Generators::Base def install rake 'db:migrate' end end However, you need to do more...
ruby-on-rails,postgresql,gem,uuid,globalize
I was not able to use the hardcoded solution provided by Thomas Engelbrecht because not all my models use uuid. Since the model is delegated we can check it's primary key type by adding a method : def primary_key_type column_type(model.primary_key).to_sym end And i'm using Rails 4.2 so I can use...
php,ruby,gem,composer-php,bundler
1) Composer is more similar to bundler. Composer brings everything in your project, bundler brings everything to your system and "links" them in the context of your project. Bundler is working with gems in the back. 2) yes. gem install does things system-wide (or per user if you use something...
In your local repository: gem build yourlocalrepo.gemspec This will create a .gem file. Now: gem install yourlocalrepo.gem ...
ruby-on-rails,ruby,postgresql,heroku,gem
You must add the pg to your Gemfile and run bundle install instead of trying to install that gem manually on heroku. Add this to your application's Gemfile: gem 'pg' ...
You can install the gem using your CLI simply by typing: gem install colorize. Then you can use them gem by requiring it, so at the top of your .rb file add require 'colorize'. Then just test it out by trying puts "This is blue".colorize(:blue). Your .rb could look like...
ruby-on-rails,ruby,import,gem,dbf
While you cannot use ActiveRecord style queries, DBF::Table is an Enumerable, so you can utilize any of the enumerable methods to do most of what you want. For example, let's say you only want widgets that were created between 1/1/2005 and 7/15/2005. Let's also assume that the widgets table has...
Basically, the problem was I did not add rbenv/bin/rbenv to $PATH. export PATH="$HOME/.rbenv/bin:$PATH Better yet, add this to your .bashrc or .bash_profile to start every session with rbenv. After that, make sure to: eval "$(rbenv init -) In order to enable shims and autocompletion. fishshell For those using fish, you...
I don't think that gem with UK cities is exists but you can try to use CSV file with GB cities from here.
Instead of messing around with system ruby, you can try setting up ruby using a ruby version manager like rvm or rbenv: rvm: https://rvm.io/ rbenv: https://github.com/sstephenson/rbenv...
ruby,ruby-on-rails-3,ruby-on-rails-4,gem,salesforce
Faraday requires a valid root certificate to establish a connection. If you're on a Windows machine, install the certificate with these instructions: https://gist.github.com/867550 For Mac, perform the following: sudo port install curl-ca-bundle Next, in your Faraday request, include this line immediately above where you actually send your request (e.g. https.request_get('/foo')):...
ruby,amazon-web-services,gem,ruby-on-rails-4.2
As I mentioned in my question, the MailForm and AWS-SES gems are not compatible out of the box. It is possible that they can be made to work together but I took a different route. Some keys to setting up AWS-SES (code included below for reference): AWS set up -...
I learned from GitLab support that running a bundle update will break many GitLab dependencies.
ruby-on-rails,ruby,gem,acts-as-audited
I've used the following method as I find it much cleaner. Added file: config/initializers/audited_additional_methods.rb module Audited module Adapters module ActiveRecord class Audit < ::ActiveRecord::Base def to_s "Added my new to_s logic here" end end end end end ...
As you say it is difficult to know whether you are actually in a test-like environment, so the solution is not to try: provide a method that allows users of your gem to indicate that sleeps should not occur. You could try and autodetect whether you should default to not...
ruby-on-rails,gem,erb,breadcrumbs
Please look into this use gretel gem with example and get some idea with proper details and implement this. Hope this will help you....
Are you using Bundler? I would recommend that. Then running your binary would be simply as: bundle exec ./bin/boss_mailer.rb Please make sure that you configure the $LOAD_PATH correctly in your boss-mailer.gemspec correctly, but if you've followed the best practices you've probably already done that....
ruby-on-rails,ruby,heroku,devise,gem
So, in general, it shouldn't be any different deploying your app on heroku than anywhere else. One difference is that on heroku you're probably running in 'production' environment settings, and locally in 'development'. You can run in production locally too, if that were the issue. But I don't think it...
You can reopen classes in ruby: class Thor::Shell::Basic def extension_method end end Or you can inlcude your extension(s) as a module (I prefer this one): module MyExtension def extension_method end end Thor::Shell::Basic.send :include, MyExtension ...