Rails 4.2 perform custom search via ransackers | Fixed issues |
- Rails 4.2 perform custom search via ransackers
- Paperclip validation of StringIO not valid
- Error with jQuery and rails
- rails : how to set locale in elasticsearch use chewy gem
- What are the correct file locations when adding a Rails backend to a JS/HTML/CSS application?
- Rails new gives "Could not find proper version of railties (4.2.5.1) in any of the sources" error
- How to make jquery stack/work together
- Rails - submit form button does not work after AJAX render
- When create an item within a category, the item can't get the category_id
- Mysql2::Error: Unknown column 'sum_hours' in 'field list'
- How to test methods in application controller? My approach makes other tests randomly crash
- How to improve code in Views on Ruby on Rails
- how to get real post.id in model with freindly_id
- uploading 3d object using paperclip rails 4 Issue
- how to eliminate empty arrays from an array of arrays in ruby?
- How to implement multi device Login in rails 3?
- How to refresh a div without reloading the entire page?
- Rails/PostgreSQL: Adding character limit to text
- ruby : when to use 'load' to load file instead of 'require' [duplicate]
- Selected values in form_for rails
- Create different database per account
- Rails Server does not load after closing terminal
- Rails Associated Table Does not update
- What is a systematic approach to debug intermittently failing specs?
- Creating a variable via the form rails
- Unicity on two columns asymmetrically
- Print the radio button value in next page in ruby
- Cannot validate empty nested fields
- How should I implement a searchable model with no table in Rails 4?
- Rails: Puma server 3 not showing database queries in development
Rails 4.2 perform custom search via ransackers Posted: 09 May 2016 06:58 AM PDT In my app I use rails-4.2 width ransack. I like to perform search customization in order to search rows that have a integer attribute = 0 or attribute >= 1. I've a price attribute in orders table. I like to define custom search like this: In a view: In a model: Can you explain me how to do that? Many tanks in advance. Stefano |
Paperclip validation of StringIO not valid Posted: 09 May 2016 06:57 AM PDT I would like to use the Paperclip gem (4.3.6) to stream a file from a 3rd party API and use the body of the HTTP response as an attachment on an ActiveRecord model representing a Fax. I am using the code below to get the HTTP response from the API server and save it as an attachment on the Fax model. (Code below is modified slightly for brevity). The I suspect that Paperclip content type validation is failing because it can't tell that that the content returned from is in fact 'application/pdf'. Why is Paperclip raising a content_type not valid error? How do I tell Paperclip that the body of the response is a pdf? |
Posted: 09 May 2016 06:58 AM PDT I got a problem with jQuery.ui and Rails. I try to solve this error since 6 hours but I can't find a solution. This is especially annoying that it seems simple. Sure I am missing something. When I add If the form is placed in ANY other view, the date picker function will not works. in application.js: in gemfile : in application.css : I face two problems :
Any idea ? |
rails : how to set locale in elasticsearch use chewy gem Posted: 09 May 2016 06:50 AM PDT I use elasticsearch by gem Chewy. and I use Globalize gem to translation. I have a model Location, and translate attribute name of location. But chewy only update last data, don't update data with different locale. I want to chewy update both data (with locale :en , :fr, ..) How to set or config globalize in elasticsearch |
What are the correct file locations when adding a Rails backend to a JS/HTML/CSS application? Posted: 09 May 2016 06:49 AM PDT I made a game in JavaScript. I have a directory called Game, and it contains:
Inside of I now want to add a Rails backend to the game. I am very familiar with writing code using Ruby on Rails, but there are holes in my knowledge of where certain files should go in the directory structure. If I transform my purely javascript/html/css game into a Rails application with a single page (the root page with the game on it), where do the files I listed above go? Here is how I think it would be:
Is this correct? Are there any other considerations to take into account? |
Rails new gives "Could not find proper version of railties (4.2.5.1) in any of the sources" error Posted: 09 May 2016 06:42 AM PDT I am trying to use Rails 5.0.0.rc1 with Ruby 2.3.1. However, if I try to create a new project within my "programming" directory, I get this: If I do a gem list, the only rails version I have installed in 5.0.0.rc1. What is interesting is I get the same error when I do rails -v, but do not when I do it from my home directory: I have tried uninstalling and reinstalling both rails and railties with the same result. I am using rvm and had to do to install nokogiri. |
How to make jquery stack/work together Posted: 09 May 2016 06:56 AM PDT Hey i'm a new programmer getting started in RoR, HTML, CSS and JS ran into a bit of a problem that im not to sure how to fix, searched the web and could't find an answer so here it is. I have a date picker and 2 dropdown menu but i cant get them to work together, each time i select something it refreshes everything. here is what the code looks like. Any help will be appreciated |
Rails - submit form button does not work after AJAX render Posted: 09 May 2016 06:33 AM PDT I've met some issue. Inside view I have a select list. On change I invoke ajax which runs controller method. In controller method I fetch expected data from DB responding to _games.html.slim File is appending fine but when I want to submit form clicking button any actions happen. What I am doing wrong or I missed something? |
When create an item within a category, the item can't get the category_id Posted: 09 May 2016 06:22 AM PDT I am building ecommerce using Rails and I got stuck with this problem: When I try to create a new item within some category from a browser, the created item doesn't get an id of the category.
In console I can verify that params get the category_id correctly:
After creating the item's category_id equals to nil. Here's my Item model file: Category model: This is my items_controller.rb file where I pass category_id to the Item: Also you can look at the whole app in: https://github.com/kaneru/estore Thanks in advance. |
Mysql2::Error: Unknown column 'sum_hours' in 'field list' Posted: 09 May 2016 06:55 AM PDT Its been nearly 2 months since i started to learn rails for doing some modifications on a plugin of Redmine in an enterprise (as a student learning the way of "life"), but this problem is something i cant find the solution anywhere. Let me explain: I needed to group a huge ammount of time entries by user_id and project_id(no problems with that) but if i do this i need to Sum the hours in those groups. The estructure is something like this:
And this information is built up with this method : I added the select because i needed all the column plus the sum one and the group by alone works well , but i cant make the Sum columns appear. This is the json code from the result of this method: The funny thing is that in other method which groups by project , the Sum column appear. In the logs, this error shows :
Referring to this code on the view that renders the time entries: Well, you cant call something that doesn't exists... 2º time asking for help in StackOverflow so if you need more info because i forgot to write it , do it :) . Regards and thanks. |
How to test methods in application controller? My approach makes other tests randomly crash Posted: 09 May 2016 05:34 AM PDT I have a simple method in the application controller: I have the following test for it: Everything works fine. Then I added another test: Also working fine. But interestingly, this 2nd test seems to break something which makes many other specs fail randomly: It's always another set of specs that fail (I guess it's some order issue), but I have no idea what could be breaking things? This 2nd spec doesn't do anything different than the 1st one, so what could it break? |
How to improve code in Views on Ruby on Rails Posted: 09 May 2016 05:24 AM PDT I have code in file views name: _result.html.erb, this file is rendered from file show.html.erb, both file in one folder And I want to improve this code in file _result.html.erb for shorter, help me please!!! |
how to get real post.id in model with freindly_id Posted: 09 May 2016 05:47 AM PDT I have a model called post that has its I want to do something like this: ' |
uploading 3d object using paperclip rails 4 Issue Posted: 09 May 2016 05:32 AM PDT I have a 3d model(.awd) extension to upload on rails app using paperclip. This error always appear to my logs Content Type Spoof: Filename Sample.awd. I try to used |
how to eliminate empty arrays from an array of arrays in ruby? Posted: 09 May 2016 05:38 AM PDT i have an array of arrays. from this i want to eliminate the empty arrays. iam using i want the result where when there is no empty array to eliminate, then it should return the same array instead of returning |
How to implement multi device Login in rails 3? Posted: 09 May 2016 05:39 AM PDT I'm using clearance(1.3.0) gem with rails(3.2.18) and ruby(2.0). Now i want to implement multi device login & maintain their devise token to push notification. When i logout from one device, it should not affect the other login. |
How to refresh a div without reloading the entire page? Posted: 09 May 2016 05:01 AM PDT I have a I tried many times with many methods (ajax call, javascript, etc...), but I don't have did it. My div displays the entire content of I display this div thanks to a Rails Partial View. Currently, I use this when the user submit the form : But it seems my partial view doesn't have an up-to-date model. Because before I add the new entity, I see for example 5 elements, and after I add the new entity, I see again 5 elements. For test purposes, I use a javascript And the alert displays Code to explain : The main view : _articles (the partial view) : My goal is to have a smooth interface which it doesn't reload the entire page any times you add an other article. |
Rails/PostgreSQL: Adding character limit to text Posted: 09 May 2016 06:01 AM PDT I want to implement a character limit to a data value on my PostgreSQL database for my Ruby on Rails application. Currently my database table looks like this: I want to change it so the "essay" only allows 10000 characters. From my limited understanding of PostgreSQL, text is unlimited by default whereas string is for 255 characters or less. I thought about implementing a Javascript conditional to not let the user hit the submission button in the client if the text is over 1,000 characters, but of course a tech savvy user could change that. What would be the most optimal way to do this? |
ruby : when to use 'load' to load file instead of 'require' [duplicate] Posted: 09 May 2016 05:20 AM PDT This question already has an answer here: i know the basic difference between load and require statement. i want to know when to use Thanks, |
Selected values in form_for rails Posted: 09 May 2016 04:41 AM PDT Only the date, out of the first_city and last:city empty. How to get selected value? view: controller |
Create different database per account Posted: 09 May 2016 05:27 AM PDT I am new to ruby on rails. I am using mongomapper and I want to create single database per account. Suppose If user will login, new database will create with the username of the login user and if already created then it will switch to that database. I am trying with the following code in the model : But I am not getting username. If I put this code "connection(Mongo::Connection.new('localhost', 27017))" in controller its giving error. Is there any way to establish new database connection from application controller. Waiting for the solution, thanks in advance. |
Rails Server does not load after closing terminal Posted: 09 May 2016 05:48 AM PDT I am trying to run the I then can get it to work if I completely reinstall ruby...not ideal. Bundle install does not help either. Any ideas? |
Rails Associated Table Does not update Posted: 09 May 2016 04:28 AM PDT I have two models
I am trying to login or Sign the Influencer But when a OLD user tries to login the OAuth Token is not getting updated Facebook Controller Facebook Client Just before saving on inspect the Oauth Token is set to |
What is a systematic approach to debug intermittently failing specs? Posted: 09 May 2016 04:56 AM PDT I have four tests in my Capybara/Rspec suite that keep failing (a real problem for CI deployment). The worst thing, these tests are failing intermittently, and often only when the entire suite is run, making it difficult to debug. They are all ajax requests, either submitting a remote form or clicking a remote link, followed by These tests even fail intermittently within the same test cycle. For example, I have several models that behave similarly, so I am iterating through them to test. Sometimes country fails, sometimes state, sometimes everything passes. I have tried adding There is quite a bit of information out there describing finicky ajax tests, but I have not found much about how to debug and fix these kinds of problems. I'm really grateful for any advise or pointers from others, before I pull all my hair out!! |
Creating a variable via the form rails Posted: 09 May 2016 04:07 AM PDT Value the variables written in variables @first_city, @last_city, @date_trip of the controller. Without creating an object in the database. Then pass the values of these variables to another page. It is possible to do that or not? |
Unicity on two columns asymmetrically Posted: 09 May 2016 04:09 AM PDT This is my table I want to add a constraint to the database so that a couple of user_id will be rejected if its symetric already exists. For example, if I already have the couple I'm using rails with postgresql. |
Print the radio button value in next page in ruby Posted: 09 May 2016 03:40 AM PDT Hi I am using 2 radio buttons: I want to print these selected radio button value in the next page like : Usage of Documents: Domestic any idea how to implement this in ruby? I have seen this eg in stackoverflow. But getting little bit confused as how to implement in my code: Discussion of the stackoverflow is below: To Get the radio button value in ruby on rails |
Cannot validate empty nested fields Posted: 09 May 2016 03:39 AM PDT I have a nested form for creating members inside an enrollment and validations on Member model. If I submit the enrollment form with all blank member fields, the enrollment saves successfully with an empty members array. If I input any member field and submit it, member model validations take action. Any ideas why this is happening? I also tried with checking only one column: |
How should I implement a searchable model with no table in Rails 4? Posted: 09 May 2016 03:22 AM PDT I have an So the main question is: what would be the best way to implement this design-wise? So far, I've found that I can do this which allows me to do some familiar things like creating objects and validation, but does not allow me to search, so I would have to do that manually. In fact, I would still need a place to store the collection (maybe a class variable or an in-memory store such as Redis?). Any help is appreciated. |
Rails: Puma server 3 not showing database queries in development Posted: 09 May 2016 05:43 AM PDT I upgraded Puma to version 3. When I start the development server ( How can I see the database queries in the development console? 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