Case insensitive search using IN operator in Ruby on Rails and PostgreSQL | Fixed issues |
- Case insensitive search using IN operator in Ruby on Rails and PostgreSQL
- Rails Activerecord, Nested Validations
- Error Message: "unsecured or incorrectly secured fault was received from the other party"
- RAILS: Don't create new record if exists
- Add quality method to refile-imagemagick
- Convert a Ruby on Rails app from MySQL Database to MsSQL server database?
- Rails 3 best_in_place_if how to add "id" attribute to element
- rails4 scoped has_many association
- Get the value of Json Array in View from Controller Rails 4
- How to perform single sql query to sum columns from grouped results in activerecord?
- Is ActiveRecord changing the encoding on my serialized hash
- Make a current Image Uploader to upload multiple images
- rubyinstaller devkit install error rake aborted
- Counting number of scaffolds Ruby on rails
- how to save a datetime column in specific time zone in rails?
- I18n together with clockwork
- Getting value of object id from new method to create
- Want to save all filters that apply on active admin gem model
- will_paginate for search result?
- How to Join more than 2 tables in Ruby on Rails?
- undefined method `first' for nil:NilClass Rails
- rails migration unique key on 3 columns in rails (sql server)
- Authenticating comments on Rails blog? [on hold]
- Rails - Split integer form field into 3 separate sections
- FactoryGirl.create always fail in spec controller
- How to hide database records from view?
- What is unobtrusive JavaScript in Ruby on Rails
- Trying to convert html to image using imgkit and wkhtmltoimage
- Disable HTML respond format in whole Rails App
- How to change ping interval in action cable rails
Case insensitive search using IN operator in Ruby on Rails and PostgreSQL Posted: 20 May 2016 06:58 AM PDT I'm new to ROR and trying to implement search in PostgreSQL database using Active Record. I've found that to make search case insensitive I can use I'm getting field name and collection of values which I need to check and case sensitive search works like that where Is there a way to update that line to make it case insensitive? If no then I believe the only way is to loop through that array and split Thanks! |
Rails Activerecord, Nested Validations Posted: 20 May 2016 06:55 AM PDT I've been worrying this bug for too many days and I'm not sure what I'm missing. I have a parent model named 'product' and a child of it 'product_attachment' Validation within child model is successful on create to disallow a blank image field via /product_attachments#new However, when using it through its parent form (files below) when I expect it to fail, Activerecord is ignoring the error, and my controller is complaining that it is blank. I'm currently in the understanding that using the 'validates_associated' would validate the child model as part of the Parent's process but this has not been working. Instead of passing a happy failed validation mid-form to allow user to take action, we leave form and the controller tries to process the create method which fails due to no attachment. Since I should always have an attachment have been trying to fix this validation to no avail. Any help appreciated, I've include similar code samples before for your feedback. I'm fairly new to rails so I'm hoping I'm mis-using a key syntax or context. Also curious what cause is and what best way was to troubleshoot as I'm still developing good debug practices. product.rb product_attachment.rb (carrierwave to handle uploading used here, seems to work fine) products_controller.rb product_attachments_controller.rb _form.html.slim (using simple_form + slim + cocoon here...) _product_attachment_fields.html.slim Noted I needed to name my file field this way for my controller to use files correctly, but unsure why still. Let me know if I can provide anything else. Thank you for your time to read/reply. Edit1: My current method to debug I'm working through as of writing this is to strip out code chunks and test functionality by through browser. I've read I should be more familiar with rails console but have not got there yet. |
Error Message: "unsecured or incorrectly secured fault was received from the other party" Posted: 20 May 2016 06:47 AM PDT We are communicating with third party, but we are getting this exception, we are not able to figure out what could be the issue, we searched and found out that their might be time mismatch issue, but we are only getting fixes for c# , how to fix it in ruby. And how to see the inner fault exception? |
RAILS: Don't create new record if exists Posted: 20 May 2016 06:29 AM PDT Basically what i need is just method (probably before_create filter) performed when creating new record to check if record with such a title exists (case insensitive) and if it is exists - return finded record and don't create new. If not - create new record. It is NOT simple Thank you. |
Add quality method to refile-imagemagick Posted: 20 May 2016 06:13 AM PDT I'm trying to add a quality optimizing method to refile-imagemagick based on this questions/answer: Optimise/compress images uploaded with refile However how do i do this? I have tried adding this file to lib: And require it in environment.rb: I might be completely off with my approach here, so please feel free to suggest a different solution. I wan tot be able to get an image that fills 1920x1080 and is reduced in filesize through the refile helper like so: |
Convert a Ruby on Rails app from MySQL Database to MsSQL server database? Posted: 20 May 2016 06:15 AM PDT I have created ruby on rails application with MySQL database. Now i want to convert my existing rails application database into MsSQL database. Is there any way convert to MsSQL server database? Thanks. |
Rails 3 best_in_place_if how to add "id" attribute to element Posted: 20 May 2016 05:53 AM PDT I am using best_in_place_if for inline editing. Here I want to catch the id of current element edited by using the ajax success event of best_in_place. Below is code snippet I am trying to add id attribute. But when I inspect the html, the value for id attribute is the default value generated by the bes_in_place. As per their doc, its mentioned that the default value can be changed by providing our own value. The default value for id attribute is shown as id="best_in_place_trip_32_is_active" and I want is only id=32 Please let me know what I am missing. |
rails4 scoped has_many association Posted: 20 May 2016 06:42 AM PDT In my I have this association in my product model. All of the products will have only one "owner" and the rest will be "member". What association should I use to to get the I could use this instance method, but I guess it would be better to define a fine association somehow. |
Get the value of Json Array in View from Controller Rails 4 Posted: 20 May 2016 06:18 AM PDT I need to get the value of the Json Array in the View Page that i have assigned in Rails 4. My Controller: Profile_controller.rb I need @search_value to be printed in the View page and here is my json Output that i get when i put render to the Value. Json Output is:
My view Page is search_view.html.erb I need to get the id from the json Output. Pls help to get it. |
How to perform single sql query to sum columns from grouped results in activerecord? Posted: 20 May 2016 06:44 AM PDT I have two models - Currently, my methods looks like: How can I improve this SQL query to get rid of |
Is ActiveRecord changing the encoding on my serialized hash Posted: 20 May 2016 05:15 AM PDT I have a Rails application which accepts JSON data from third-party sources, and I believe I am running up against some ActiveRecord behind-the-scenes magic which is recognizing ASCII-8BIT characters in hashes extracted from the JSON and saving them as such to my database no matter what I do. Here is a simplified description the class ... and of how an object is created ... I believe those are ASCII-8BIT characters, so fair enough if they are saved as such (despite my attempts to UTF8 everything everywhere). But I need these characters to be UTF-8, because when I go to view them I get: where line #28 in So I sought to re-encode any string in the Hash. I built out functionality to do this (with anonymous classes and refinements to What is ActiveRecord doing to this hash when it saves it? And what can I do to store a hash permanently with all strings encoded to UTF-8 in a |
Make a current Image Uploader to upload multiple images Posted: 20 May 2016 06:23 AM PDT I want to make a change on my current model to be able to upload more than one picture. Currently, only one allowed. I have searched stackoverflow but it only shows how I can install carrierwave and make a model to upload multiple picutres FROM SCRATCH. Here, I want to change my current model, so differently. I will show you what my model look like now. properties.html.erb property.rb db -> add_image_to_property.rb Hope I could find a detailed explanation. |
rubyinstaller devkit install error rake aborted Posted: 20 May 2016 06:33 AM PDT I am trying to install rubyinstaller. after and get in directory rubinstaller and put command I get message any idea ? i am using UBUNTU 17.3 |
Counting number of scaffolds Ruby on rails Posted: 20 May 2016 06:13 AM PDT I'm made a page scaffold and want users to create only one , so is there any way to count the scaffolds for a specific user and stop him from making more than one . |
how to save a datetime column in specific time zone in rails? Posted: 20 May 2016 05:01 AM PDT currently, I am in |
Posted: 20 May 2016 04:42 AM PDT When a model method "model_method" is called from clockwork, I18n.locale always equals to my default locale. How do I pass the current locale to the model method? Part of Part of |
Getting value of object id from new method to create Posted: 20 May 2016 05:18 AM PDT I have problem with getting value of found id from new method to create. New method: Result of @person: @vacation.person is also good. For now all is well. But after this, when I fill form and click submit: Result: But now @person is nil and also @vacation.person is nil. I don't have idea how to send value of id to create method. Method to find id. vacation_params: |
Want to save all filters that apply on active admin gem model Posted: 20 May 2016 04:29 AM PDT I want to save all filters value that apply on a gem , is there any default way in active gem. Otherwise i am getting these filters in params "q" i have to parse it and save into Database. But is there any build in feature in active admin which will let me do the above mention task. |
will_paginate for search result? Posted: 20 May 2016 04:41 AM PDT I am using will_paginate gem for the pagination on my application. I have created a search action with the following code. Controller search.js.erb _result.thml.erb index.html.erb pagination.js It somehow works for a index action, ajax method works for the links but when the I click on the last or the first page links generates like localhost:3000/control?_=1463743428904&page=1 also, when ever I hit the search, the pagination links throws link like localhost:3000/control/search?from_date=2016-05-18&page=2&to_date=2016-05-20&utf8=%E2%9C%93 which should be like localhost:3000/control?page=1. Is there any solution for this. |
How to Join more than 2 tables in Ruby on Rails? Posted: 20 May 2016 05:07 AM PDT I have 4 tables categories users user_details galleries I want to get all the user information which user id=1 with user_details and category and show her/her all the is_active=1 images from the Here is my code - Here I am getting error message: Actually I have associate category.rb user.rb user_detail.rb gallery.rb Let me know why |
undefined method `first' for nil:NilClass Rails Posted: 20 May 2016 04:27 AM PDT I know this error, i know what it means but in this case it makes absolutely no sense. I have a form that used to work well. And i have another form almost the same working nicely. However this form now gives me this error when i submit the data: _form.html.erb Controller This collection_select if fetching the data correctly! Everything show's up the way it should but when i submit i get that error and i dont understand why. |
rails migration unique key on 3 columns in rails (sql server) Posted: 20 May 2016 04:10 AM PDT I have this table on my Database: I want to create a migration that creates a multiple unique key on columns: month_holidays_id, month and language. How I do that? When I do add_index (code below) this create a index but not a unique key in my sql server database. |
Authenticating comments on Rails blog? [on hold] Posted: 20 May 2016 03:28 AM PDT I am building a basic Rails blog using devise for admin login. When you view a blog post there is an option for leaving comments at the bottom, but right now anyone can leave a comment. What I want to do is make it so that when you click on the text_area, a user will be prompted to sign in using a link to their facebook with omniauth or their email address. How will I go about achieving this? Thanks in advance. |
Rails - Split integer form field into 3 separate sections Posted: 20 May 2016 03:32 AM PDT I have a time field which stores an integer(minutes). I want the user to be able to enter in days, hours and minutes in the form rather than entering minutes. Is there an easy way to do this via the form so that I would have...? I realise I could just have days,hours and minutes as database fields but I'd rather just keep my single time field. |
FactoryGirl.create always fail in spec controller Posted: 20 May 2016 03:33 AM PDT So I have users model I create it with scaffolding the test is passed in model spec but it always fail in controller spec my users_controller_spec my User's FactoryGirl I can create user from my console and from my user model spec but it always fail when I try to create it from my controller spec |
How to hide database records from view? Posted: 20 May 2016 04:12 AM PDT I'm beginner in Ruby On Rails and I'm reading "Getting Started with Rails" now. I created models and controllers for Article and Comments, everything ok, I'm able to add comments and they appear on Article view, but besides I see records from database in this format: Why they appear and how to hide it? Code of Article's view show.html.erb: |
What is unobtrusive JavaScript in Ruby on Rails Posted: 20 May 2016 03:00 AM PDT I am new to Ruby on Rails; I want to know what is unobtrusive JavaScript in Rails. I Google it and see examples but I can't understand the purpose and meaning of unobtrusive JavaScript. Is it different from normal JavaScript? |
Trying to convert html to image using imgkit and wkhtmltoimage Posted: 20 May 2016 05:30 AM PDT Trying to convert the HTML content into image using ImgKit and wkhtmltoimage. Image is converted successfully but facing the issues with fonts (Font Awesome). The image is not look as it as HTML content. Attaching 2 images one which have HTML content (HTML-CONTENT.png) and other one is converted to image (HTML-Converted-To-IMAGE.png). You can see the difference in fonts between the 2 images. Could you please anyone suggest me on this, how can I achieve exact html conversion into image. Thanks for the help in advance. |
Disable HTML respond format in whole Rails App Posted: 20 May 2016 03:50 AM PDT I use pure javascript frontend template to handle all requests with Rails via JSON API However, I don't know why sometimes the exception will give me the error message in HTML format. Because I've already set the API request format in JSON Controller (I only keep format.json in the controller) Route.rb |
How to change ping interval in action cable rails Posted: 20 May 2016 03:16 AM PDT I'm using action cable and receiving pings from server after each 3 seconds interval (mentioned in the action cable library). My question is: How to change the ping interval at the time of subscription. Any idea? Thanks in Advance. |
You are subscribed to email updates from Newest questions tagged ruby-on-rails - Stack Overflow. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment