Data dodania Pytanie
2017-01-10 13:01 Unable to create a model in Rspec via Post »
I'm trying to create a User in Rspec: require "rails_helper" RSpec.describe UsersController, type: :controller do describe "POST #index" do it...
(1) odpowiedzi
2017-01-10 12:01 Hiding some of query string in rack »
I have written a sinatra app for displaying data from a database. The user can put a customer number into a form. This is then dealt with via a route ...
(1) odpowiedzi
2017-01-10 10:01 Redirect with cookies »
Is it possible to redirect to other domain with cookies? I tried followong. def test_redirect response.headers['Cache-Control'] = 'no-cache, no-sto...
(1) odpowiedzi
2017-01-10 06:01 Creating a list or array of objects in Ruby on Rails »
I am trying to make it possible for the users of a web application I am building to create lists of objects that they have created. For example, the ...
(2) odpowiedzi
2017-01-09 23:01 Run Rails controller before_action callback after others »
Is there a simple way to append to the before_action list for a controller in rails, such that other before_action callbacks added later will run befo...
(1) odpowiedzi
2017-01-09 22:01 What does f.object do in the Rails form builder? »
I am learning Rails 5.0 from a tutorial, and in that tutorial it uses f.object, which I am unfamiliar with. The f.object is being passed into ERb, int...
(3) odpowiedzi
2017-01-09 21:01 Ruby on Rails: Add form for another model on a form »
Within my Ruby on Rails application I am trying to implement a relationship between Group and Contact, whereby one group can contain many contacts and...
(3) odpowiedzi
2017-01-09 11:01 rails mysql regex input not getting sanitized properly »
I am doing the following on a rails 3 app def test(str) User.where("name REGEXP ?",str).last end Using the format above, rails generally handle...
(1) odpowiedzi
2017-01-09 04:01 Rspec: controller spec login helper »
I am using rspec to test my controllers. The problem is that I need a login helper method every other controller tests will use in its before(:each) d...
(0) odpowiedzi
2017-01-09 01:01 Ruby -- Adding the values of sub arrays in an array by their key »
So I know how to add all the values in an array. Example, the sum of [1,2,3,4]... [1,2,3,4].inject(&:+) #=> 10 However, I have an array o...
(4) odpowiedzi
2017-01-08 23:01 Why in Rails table fields are defined in migrations but not in models? »
I am studying Ruby on Rails and confused with structure of files and code.. Why in Rails table fields are defined in migrations but not in models? I k...
(1) odpowiedzi
2017-01-08 22:01 Ruby: Is it possible to determine the class that my Ruby method is executing in without hardcoding the classname? »
I am a Nuby to Ruby. I am looking for a way to get the containing Class object of the method of the current line of execution. Is this possible withou...
(2) odpowiedzi
2017-01-08 21:01 Add custom directive for strftime in ruby »
I would like to add a %custom directive to strfime that will translate months to the code used in some financial/trading reports January => F Feb...
(1) odpowiedzi
2017-01-08 19:01 In Ruby, can I check if a string contains a letter without using regular expressions? »
I'm using Rails 5. I want to know if a varaible (which you can assume is a String) contains at least one letter (upper case or lower case). However,...
(3) odpowiedzi
2017-01-08 18:01 ruby on rails : <top (required)>': superclass must be a Class (Symbol given) (TypeError) »
In my rails server, this error occurs when I enter 'rails console production' and I don't know why. What I'm trying to do is generate user information...
(2) odpowiedzi
2017-01-08 16:01 Ruby on Rails update_attibutes not working »
I am trying to set an user as admin, the method is: def set_user_admin if admin_true? == true user = User.find(params[:format]) if us...
(2) odpowiedzi
2017-01-08 08:01 Not sure how this code reads »
I'm browsing github looking at cool code, but don't understand what this code does: I understand that there are 2 belongs_to associations, but I don'...
(2) odpowiedzi
2017-01-07 22:01 Why should we avoid using rescue in its modifier form? »
I will define value. But this value may be in value of key of hash. I will use rescue for define value is nil if this keys is not exist. for example ...
(4) odpowiedzi
2017-01-07 22:01 what is the named constructor equivalent of the literal constructor for the Range class? »
somewhat new to rails. I am working through the exercises on 4.4.1 in Michael Hartl's learn rails tutorial and i'm a bit unclear as to what the named ...
(2) odpowiedzi
2017-01-07 21:01 Rails Alternative to use polymorphic associations »
I've see that the polymorphic association break the rules of relational db design and in the end cause more harm to the app. so, the left alternative ...
(1) odpowiedzi
2017-01-07 20:01 How to install ruby and bundler via Chef? »
I'm new to Chef and I'm trying, for hours now, figure out how to install ruby and install the gem bundler, I'm new to ruby too. I would like to clone...
(1) odpowiedzi
2017-01-07 16:01 Generating binary files with Sitespec fails when a Padrino Rack app »
I am working on a project with Sitespec, which is a static site generator using RSpec and uses any Rack app. I chose Padrino as a Rack app for Sitesp...
(0) odpowiedzi
2017-01-07 13:01 Faster way to see if a huge list of strings is contained within another string »
I have a list of around 300k common words stored in an array. So, 1 element of the array = 1 word. On the other side, I have a huge list of strings t...
(3) odpowiedzi
2017-01-07 12:01 MySQL Gem Install Error on Ruby 2.4 »
I have a problem with an install of mysql gem. This is my error : gem install mysql -v '2.9.1' Building native extensions. This could take a while.....
(1) odpowiedzi
2017-01-07 08:01 Firebase authentication for Sinatra (Ruby) web app »
Is it possible to use Firebase for authentication of a Sinatra app in much the same way that I can use Auth0, and if so, how? The samples from Firebas...
(0) odpowiedzi
2017-01-07 06:01 How do I raise a fatal exception ruby? »
Ruby has a fatal exception, but there is no guidance on how to raise it and I cannot figure it out. How do I raise a fatal exception in Ruby? ...
(2) odpowiedzi
2017-01-07 06:01 If I schedule a worker to run every day on Heroku, how can I be sure it doesn't run twice or get skipped? »
I'm a bit confused as to how Clockwork, Sidekiq, and Redis all fit together on Heroku given that Heroku restarts dynos at least once a day. Say I hav...
(2) odpowiedzi
2017-01-07 05:01 Testing that Devise is re-sending confirmation instructions email in a background worker »
I want to send Devise confirmation instructions to users a second time if they haven't confirmed within two days of signing up, however I can't seem t...
(0) odpowiedzi
2017-01-07 04:01 How to achive abstraction and encapusulation in ruby on Rails? »
How to achieve abstraction and encapsulation in ruby on Rails? Without using any gem? ...
(0) odpowiedzi
2017-01-07 03:01 Accessing instance variables within a Sinatra application »
This question has been rewritten because the way I originally wrote it was unclear. How do I take the values within @form_params and pass them to get...
(2) odpowiedzi
2017-01-06 22:01 Mock Rails 4 application config custom value »
In Rails::Application, I add a custom configuration using... config.x.cache_config = config_for(:cache) In my tests, I want to see how code using t...
(1) odpowiedzi
2017-01-06 21:01 Rails 4 ActiveRecord::first not working »
I'm debugging some legacy code in a Rails 4.1 app and I'm seeing some confusing results from this: #order.rb # get the most recent order from the sa...
(1) odpowiedzi
2017-01-06 19:01 Update hash value in class »
Here I have a little demo-code: class UpdateHash def initialize(value) @value = value save end def save @value = 10 end end ha...
(3) odpowiedzi
2017-01-06 19:01 SINATRA/Ruby - changing the name of the routes »
Here's the problem. I created an app and I have started doing some tidying up to make the code neater. I have changed the names of the paths from '/fw...
(0) odpowiedzi
2017-01-06 18:01 Ruby and RubyDev under Chocolately on Windows »
I have installer ruby 2.3.1 ruby.devkit 4.5.2.20120101 from the chocolately repostory on windows 10 then i have modified conf.yml and run: PS C:\too...
(2) odpowiedzi