Data dodania Pytanie
2017-02-01 18:02 Redirect users based on if they are signed in or not in rails »
I want to set a root_path for my rails app where I want root to be devise/sessions#new if user is not signed in and home#index if user is signed in o...
(3) odpowiedzi
2017-02-01 18:02 change routes URL from a random :id to :username in rails »
I want to change my routes.rb file in a way so that it changes my current urls localhost:3000/amitian/1 to localhost:3000/username I will provide...
(2) odpowiedzi
2017-02-01 15:02 Render path with params »
I have two models, Carousel and Item, their relation is many to many. In routes.rb: resources :carousels do resources :items end I'm trying to r...
(1) odpowiedzi
2017-02-01 14:02 How to query .where on array of clients? »
Using Rails 5. I have an ordered array of clients. It's not possible for me to get an AR out of it, and this is the only way I can get these clients....
(1) odpowiedzi
2017-01-31 19:01 Rails 4 ERB: consistent date format »
I have read several posts such as How to format time and date from db:datetime record in Rails 4? and Custom date time format in rails 4 and I feel li...
(2) odpowiedzi
2017-01-31 09:01 How I can skip callback in action »
I have controller looks like class BarsController < ApplicationController after_action :some_method, only: [:index] def index get_cac...
(1) odpowiedzi
2017-01-31 08:01 ActiveRecord update_column: How to increase a record value depending on it's current value with just one query »
How to do this hitting the Database just once: @user = User.find(123) @user.update_column(:views, @user.views + 1) Something like this: User.find(...
(4) odpowiedzi
2017-01-30 21:01 Force user to reset password on first login with Devise »
[ETA updated at end with my current solution] I want to be able to manually create accounts for high value users, which means we have to generate a p...
(1) odpowiedzi
2017-01-30 18:01 acts_as_votable gem likes all the posts on page in rails »
Lemme explain what I mean, the point is that I am using acts_as_votable gem in my rails app and it works fyn, problem is that I am using ajax and I am...
(1) odpowiedzi
2017-01-30 13:01 Error with Ruby gems (Ruby on Rails) »
I'm still getting an error with my gemfile, I can Download all the gems, but at the moment of 'rails server' I'm getting this error: /home/administra...
(1) odpowiedzi
2017-01-30 10:01 active job in rails 4 »
I am looking forward to active job for active record for rails 4. I search related to it. I found gem 'delayed_job_active_record' . But this supports ...
(1) odpowiedzi
2017-01-29 20:01 How to access Form.select values in rails »
I have this form where I want users to select how they want to post. Either with their name or anonymous. So this is my form for that: - @anonymous....
(1) odpowiedzi
2017-01-29 18:01 Convert a floating point hexadecimal to float in Ruby »
I converted a floating point number say 1.012 to hexadecimal using Javascript by using the command 1.012.toString(16) and now what can be done to reve...
(2) odpowiedzi
2017-01-29 16:01 Upgrading has_magic_columns gem to support Rails 4/5 »
I'm using this gem (https://github.com/latortuga/has_magic_columns) to allow my customers to define custom attributes on a per-account level. e.g. for...
(1) odpowiedzi
2017-01-29 12:01 page layout on prawn unable to set inside class »
i have searched in prawn about page layout in prawn and it showed this pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape...
(1) odpowiedzi
2017-01-28 19:01 Rails: undefined method `inject' for nil:NilClass »
I'm trying to sum up the minutes_out per day with this: <%= @activities.where(created_at: date.midnight..date.end_of_day).map(&:minutes_out)....
(2) odpowiedzi
2017-01-28 16:01 rake task not running sub-tasks in order specified »
In a rails 4.2 app, in Rakefile, I have this: task(:default).clear task :default => [:test, 'bundle:audit'] The output, always has bundle:audit ...
(1) odpowiedzi
2017-01-28 11:01 how to create guest user to angular rails app without populate database? »
I have angular - rails web application. My web app is already in production mode.i'm using devise gem. I want to create a demo for Guest Users to logi...
(0) odpowiedzi
2017-01-28 00:01 How to handle nested params in rails controller. »
I have params that are coming into the controller looking like this: { invitee: { first_name: first_name, last_name...
(1) odpowiedzi
2017-01-27 22:01 Getting RuntimeError: "In order to use #url_for, you must include routing helpers explicitly" when I've already included them »
Inside a controller I've tried to run this code for when users that are already logged in stumble across the sign up page def index if current_user...
(1) odpowiedzi
2017-01-27 13:01 Perform strftime on created_at in pluck »
In Rails, how can I perform a .strftime on created_at in a .pluck? I'm simply trying to convert the created_at inline: Entry.where(client_id: @clien...
(1) odpowiedzi
2017-01-27 12:01 How does || work in?: @client = client.find(params[:client_id] || params[:id]) »
New to rails. Following a tutorial on polymorphic associations, I bump into this to set @client in create and destroy. @client = Client.find(params[:...
(4) odpowiedzi
2017-01-27 06:01 Update database column in rails »
I have a problem, I want to update my database's "active" column. my schema = tablename(name:string , id:int , active:0 ,created_at) I want to u...
(3) odpowiedzi
2017-01-26 16:01 How to index a polymorphic table in rails with unique “attendable_type” and “attendable_id” - Rails 4 »
Could one kindly please tell me where i am going wrong. How do you index a polymorphic table in rails with unique initial migration: class Cr...
(1) odpowiedzi
2017-01-26 14:01 Ruby on Rails - Different elements for each do slices »
In my application I do each_slice and then each_with_index because of some stuff I'm doing in my application. My current code is like this: - @image...
(1) odpowiedzi
2017-01-26 03:01 Rails 4 rspec test fails before code is run »
EDIT: My initial assumption was incorrect. It seemed like my test was hitting its assertions before it even finished running all of its code blocks, b...
(3) odpowiedzi
2017-01-26 00:01 Rails 4: User can only view their own orders »
I am giving clients the ability to place food orders through my app. They can view their order index by visiting the following URL: localhost:3000/c...
(1) odpowiedzi
2017-01-25 17:01 Ruby on Rails: How to validate if on specific page? »
In my Ruby on Rails application I am trying to add in validations that will ensure the user has entered a value in a text box. In my system I have a t...
(3) odpowiedzi
2017-01-25 09:01 Rails: How can I retrieve values from columns named `id`? »
Using Rails 4.2.6. I've got a table like this (please forgive the odd table & field namings -- they're from an ancient non-Rails project): mysql&...
(1) odpowiedzi
2017-01-25 06:01 Is it possible to find nearby cross street in New York using geocoder? »
How can i find cross street for a restaurant or building using geocoder like yelp? https://www.yelp.com/biz/am%C3%A9lie-new-york?osq=Restaurants 22 ...
(0) odpowiedzi
2017-01-25 05:01 select_tag not passing param »
My select_tag is suppose to auto post when a item is selected. It does but when I view the params in byebug I get a empty id in the params instead of...
(1) odpowiedzi
2017-01-24 21:01 Ruby on Rails: Display confirmation message if not includes »
In Ruby on Rails, is it possible to display a confirmation message if the user has not entered a string in a text field? I have a form whereby a user ...
(1) odpowiedzi
2017-01-24 20:01 Bignum to Fixnum ClassCastException error using mongoid under JRUBY »
I am having trouble with using Mongoid in a Rails app under JRuby. I can insert records and count records, but any attempt to query results in the fol...
(0) odpowiedzi
2017-01-24 17:01 How do you get a list from complex active record has_many involved from a subset of downstream objects »
I'm having a hard time getting a list of the games involved from a hierarchical parent relationship when multiple foreign keys are implemented on a re...
(2) odpowiedzi
2017-01-24 11:01 Double has_many attributes »
I'm beginner in rails and having trouble finding a proper way out with my problem. I have three models : Conversation, participant, messages which ha...
(1) odpowiedzi