Ransack has_many through | Fixed issues |
- Ransack has_many through
- Stub pundit in RSpec request specs
- reprocess! ignores convert_options rails paperclip
- Mailchimp Templaet Send to Mandrill option is broken for actual email
- Mailer can't find template, using path to archived release folder
- How to put multiple form_for's on the same page
- Seed acts-as-taggable-on with tags set to different categories
- Rails: How to upload your Heroku PG database to your local (SQLite) development environment?
- Using the Acts_as_votable gem with Angularjs
- Copy file to new folder with FileUtils
- Capybara look through whole page
- Render result for a Form rails / gem geocoder
- ActiveRecord Connection Adapter return value
- I want to get TAX/VAT by marketplaces from Amazon API via gem peddler. How can I get tax/vat values?
- Paper_trail and Rails_admin undefined 'version_class_name'
- jquery.turbolinks not working on $(document).ready in Rails
- Why I get CSRF warning in my application?
- Is it bad to group together like tests into a single test?
- How to make beta test evironment from prod in rails?
- Rails Upvote Routing Error
- Huge number of rows in pivot table (Postgresql)
- What is the best way to duplicate a row in Ruby on Rails
- Import html to rails method (in helper.rb)
- Autosaving record on multiple unsaved belongs_to relationships
- pg_search multisearch sort by attributes of searchable
- Linking many existing models to one new one. Ruby on Rails
- ActiveAdmin sortable_handle_column sort with scope
- Can't sign_in user with twitter account, devise omniauth
- input a javascript string to ruby asset_path
- show custom records in activeadmin index page
Posted: 17 Aug 2016 07:42 AM PDT Trying to get the right association between Shop and Products here: shop.rb I want to sort the shop items based on product price. The page is rendering but there is no link between the view and the controller. How can I get Shops and Products joined? shops_controller.rb routes.rb Search view Show view |
Stub pundit in RSpec request specs Posted: 17 Aug 2016 07:38 AM PDT I want to stub pundit in RSpec request specs. I have the controller action that looks like this: I have also simple spec: This spec passes. But when I change this: to this: which is not correct. What I'm doing wrong? |
reprocess! ignores convert_options rails paperclip Posted: 17 Aug 2016 07:36 AM PDT I am working on already existing images and styles on s3 where I updated :convert_options for some reason. These options work flawless when new images are uploaded but however, when I call Image.last.photo.reprocess! from console for the existing model and code below, the command seems to ignore :convert_options. i say so because the Image model has an updated updated_at time but there's no conversion applied. Please let me know where I am missing out or help me a better way/script to do so. Following is the code I have: |
Mailchimp Templaet Send to Mandrill option is broken for actual email Posted: 17 Aug 2016 07:13 AM PDT Following this article: https://robots.thoughtbot.com/how-to-send-transactional-emails-from-rails-with-mandrill I created a drag and drop template in Mailchimp and sent it to Mandrill. Mailchimp preview and test email is good. For Mandrill, preview is good but actual email is broken, like no background color for body of email. Creating template from scratch is not an option because I need my client to be able to take advantage of the Mailchimp drag and drop to edit templates. thanks! |
Mailer can't find template, using path to archived release folder Posted: 17 Aug 2016 07:42 AM PDT Only in production, action sends email which doesn't get sent citing this issue:
Notice the reference to the dated folder that's too old and no longer on the server. My mailer code is this: I can assure you that in my views, the path to the file is Can someone help me get the mailer to look in the "current" folder instead please? |
How to put multiple form_for's on the same page Posted: 17 Aug 2016 07:12 AM PDT Oke guys i'm busy making an invoice app and i'm kinda stuck atm. On the invoice page i have something similar like But when i save the invoice and try to edit it again the customer details are gone. How do you put multiple form_for's in one page and save them all with one submit button? |
Seed acts-as-taggable-on with tags set to different categories Posted: 17 Aug 2016 07:03 AM PDT Im trying to figure out how I can prepopulate my tag list for the different categories. I have two tag list that I use (cuisine_list, technique_list) and have a list of items I would like to prepopulate my tags with so that there is some suggestions in the autocomplete for them. I know I can use the seed file to do something like this: But that doesnt create the association with the specific tag_list. How can I add them to the cuisine_list or technique_list? |
Rails: How to upload your Heroku PG database to your local (SQLite) development environment? Posted: 17 Aug 2016 06:46 AM PDT I am a rails newbie and have a production app that is deployed with Heroku. I would like to upload my production database (PG) to my local development environment (SQLite). I am sure this is straightforward but I want a SAFE method to do this (i.e. without any risk of damaging my production data). |
Using the Acts_as_votable gem with Angularjs Posted: 17 Aug 2016 07:45 AM PDT Basically I want to access Acts_as_Votable through an Angular template. I have a list of cars that people can vote on. However, I can't display the votes when the list is rendered in Angular. I'm guessing I need to pass some sort of association for :votes when the json gets rendered in the controller, like with :marque. This is where I've got to so far. Can't for the life of me work it out and resorted to actually asking a question rather! Cheers cars_controller.rb index.html.erb |
Copy file to new folder with FileUtils Posted: 17 Aug 2016 06:17 AM PDT I'm developing a RoR app and want to move a file 'flower.png' from My migration: Do I need to |
Capybara look through whole page Posted: 17 Aug 2016 06:16 AM PDT How to set up i have button which located almost in the end of page,so need to scroll down to see it,and I use |
Render result for a Form rails / gem geocoder Posted: 17 Aug 2016 06:59 AM PDT I would like to render the result of my form when users are clicking on the "Search" button.
I have a controller : Searchscontroller and a form in search.html.erb My users have been located with the gem geocoder, that part is fine, I got Lat and Longitude (and the city in DB, its working in the console User.Near('City') ), but I just would like to display a list of result , like this when I click on the form :
I hope someone got the answer for me, many thanks in advance Route.rb |
ActiveRecord Connection Adapter return value Posted: 17 Aug 2016 07:25 AM PDT I had a bit more complex sql-query which i decided to use plain The method basically looks like that: The serializer On standard queries where i use AR i receive nicely formatted json with the correct types. How can i retain the correct types of all the values when using the ConnectionAdapter directly? Thanks for everything! |
I want to get TAX/VAT by marketplaces from Amazon API via gem peddler. How can I get tax/vat values? Posted: 17 Aug 2016 05:48 AM PDT
I want to get TAX/VAT by marketplaces from Amazon API via gem peddler. How can I get tax/vat values? |
Paper_trail and Rails_admin undefined 'version_class_name' Posted: 17 Aug 2016 05:45 AM PDT When I try to add history to my admin I get the following error: I have the two gems install (remotipart and rails_admin >= 1.0.0.rc) and in my rails_admin.rb file I put in this: Ive tested the paper_trail versions in the console and everything works fine. I have added the object_changes column per the instructions also. |
jquery.turbolinks not working on $(document).ready in Rails Posted: 17 Aug 2016 06:09 AM PDT After realising my rails app was experiencing the well known issue of Here is some of my code: In application.js: Example of JavaScript not working: |
Why I get CSRF warning in my application? Posted: 17 Aug 2016 05:39 AM PDT I find a very interesting bug in my app: when user with bad internet connection open a page and while this page is loading, user click on the modal window with form - he get an error why user get this error? it is bug or feature? |
Is it bad to group together like tests into a single test? Posted: 17 Aug 2016 07:22 AM PDT My team is using Cucumber / Ruby on Rails. We have some scenarios such as the following: A co-worker is asking that I group together all of the invalid tests into a single scenario. His reasoning is because when we sit with our Quality team, we have to read all of the scenarios aloud, and it would save time by only reading one instead of many. I don't think I can agree with this because I feel that tests should be completely isolated. If I want to add a new invalid scenario, then I would have to run more code than I need to if they were grouped together. I wanted to know if anyone had a more official answer. Is it bad to group together like tests into a single test? |
How to make beta test evironment from prod in rails? Posted: 17 Aug 2016 06:07 AM PDT I have a rails application which is having a bunch of tables in its schema. The database is stored on a different machine. And I can handle all the queries like update/search from MySQLWorkBench I updated one of the table by adding two columns in it from MySQLWorkBench not by running any rails command. So, is there anything else that I need to do so that my schema.rb is changed or it'll change automatically? In case I am supposed to run a command to let the changes reflect in schema.rb please guide me at what directory I'll run it and on which machine (My developer desktop or the machine on which database is stored). |
Posted: 17 Aug 2016 05:43 AM PDT I'm getting an error, and have tried debugging it but with no avail. I've just added a 'like' button to my site that allows users to like a
This is the like button code: This is the relevant code for my documents controller: This is my I'm not sure what I'm doing wrong? How come the code works while in the show.html.erb file, but not while in the index.html.erb file? I'm using the acts_as_votable gem by the way. |
Huge number of rows in pivot table (Postgresql) Posted: 17 Aug 2016 06:08 AM PDT I have a database of videos. Each video can have multiple categories, so I have pivot table to connect category and video together. The problem is that the video_category pivot table has 4769325 rows, which I think is huge for such a simple thing. Is there better way how to store the relation between video and category and still be able to query through them? It's a RoR app with Postgresql DB. |
What is the best way to duplicate a row in Ruby on Rails Posted: 17 Aug 2016 05:21 AM PDT I have a list of data and I'd like to duplicate a row when an user click on the copy button. Example: This is the current list: If an user click on user 02 copy button, this row should duplicate (and persist on database) like that: What is the best way to do this? I hope that I was clear. Tks in advance |
Import html to rails method (in helper.rb) Posted: 17 Aug 2016 05:14 AM PDT I need piece of code for couple of times, and to follow DRY method (don't repeat yourself) i want to escape using this piece and retyping it for 5 times or more. So I want to define method what will contain both ruby and html, and ruby in html and js to, code. But I have problems with realization. My html.erb look like this: And I want create method, I think in application_helper.rb will do with this piece of code. What will look something like that: The result what I want for html.erb How can I make this to work? |
Autosaving record on multiple unsaved belongs_to relationships Posted: 17 Aug 2016 05:22 AM PDT Given a three-model setup like this in Rails 5 (so the the following test fails:
Is this a bug or am I doing things very wrongly? I'm currently working around this problem, and have also considered a |
pg_search multisearch sort by attributes of searchable Posted: 17 Aug 2016 04:58 AM PDT I have a rails app in which I am trying to implement pg_search. |
Linking many existing models to one new one. Ruby on Rails Posted: 17 Aug 2016 05:45 AM PDT So I am making an app that reviews books, articles and the like. I have created the backbone of the app by creating models, views, controllers etc for Piece(the book or article), Section(self explanatory), Subsection, and Subsubsection. I want to add a new model into the mix, a "Links" model (which will just be a link to another source or website). My issue is that I don't know how to make ALL of my previously stated models have "Links". I want each of The above models to have access and CRUD capabilities to their "Links", but so far all i have read about is has_many or has_and_belongs_to_many. As far as I understand, those kinds of relations only relate ONE model to ONE other model, even if Piece might have many Sections, it only relates these two models. I guess the Links model would have to have an obligatory piece_id, but then optional id's such as: section_id, subsection_id depending on where the link was. So if in Chapter 3 of my first book i want to add a link, it would have an obligatory piece_id=1 and then a section_id=3, but then no subsection_id or subsubsection_id. So how do I go about creating a model such that it belongs to several other models? Or is this even possible? |
ActiveAdmin sortable_handle_column sort with scope Posted: 17 Aug 2016 04:43 AM PDT I am using "activeadmin-sortable" gem for drag & drop sorting in active admin. Everything works fine, but what is my problem is, I need to use a scope for this page. For example, I have Event Model and Event Categories Model. Here, Event -> has_many -> EventCategories. I have applied sorting for Event Categories model. When I drag & drop any record, it will go to the 'sort' method with the params position & id and then it will automatically calculate and re-order the positions based on the dropped position. Here, the resultant data will be for the whole event categories model, not for specific event's categories. I want to apply an event scope for this calculation. I tried with the 'super' class like we override other active admin methods, but it shows error as 'superclass' is not available for 'sort' method. I want to apply this re-ordering only for the event's categories, not the whole event categories table. because, this table will contain same values belong to various events. |
Can't sign_in user with twitter account, devise omniauth Posted: 17 Aug 2016 04:40 AM PDT I am making plugin for engine which will enable omniauth login via twitter or facebook. When i try to sign in user with twitter account i get message:
What can cause this issue? I got following: my_engine_model_extenders.rb config/initializers/devise.rb callbacks_controller.rb routes.rb |
input a javascript string to ruby asset_path Posted: 17 Aug 2016 04:30 AM PDT I am trying to call an asset_path on a javascript variable, but it doesn't seem to work. My code looks like this: filename is simply a string that the methode gets. if i call the mothod like the following it does work: |
show custom records in activeadmin index page Posted: 17 Aug 2016 04:24 AM PDT I want to show venues in a conditional approach on index page in activeadmin like if a current_admin_user role would be super_admin then he can view all records, if current_admin_user role would be city_manager then he can also view all records but if current_admin_user role would be venue_manager then he can only view there venues. I am not able to do this, I have venues as per conditional approach but let me know how to use venues variable to list out venues on index page 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