Rails - how to place text onto an image within a code loop | Fixed issues |
- Rails - how to place text onto an image within a code loop
- Best practice for waiting for image processing?
- ActiveRecord accessing database when there are restrictions
- How to check elasticsearch tokens after running a query in Rails?
- How to use rails act_as_sortable gem, with several belongs_to relations
- RSpec Capybara - Request test. Need advise
- Refactoring ruby code , nested loops for exporting to csv
- How to retry if jobs in cron fails?
- Rails - eager loading with has_many_through association
- Sidekiq Redis database keys increasing over time
- rails - how to translate what is within a ruby code in a form format?
- ActiveRecord::StatementInvalid (NoMethodError: undefined method `query' for nil:NilClass: ROLLBACK)
- Rails multiple objects select box
- How to install nokogiri 1.6.7.2 on windows
- "no implicit conversion of nil into String"in the Search Module of Redmine
- Getting location(city, state) from ip_address for bulk data with rake task
- undefined method `each' for nil:NilClass in update method
- How to update form fields real time in rails [on hold]
- How to split Devise edit page form into two pages?
- Quikchex test application
- Refreshing partial div's with java on a set interval
- how to get the id of the @mentioned_name from the Jquery at-who plugin
- Date.today updation issue in rails and postgresql
- Ransack sorting associations one to many
- Rails- paperclip- NoMethodError
- AWS Opsworks executing deploy hooks in "setup" stage
- Rails 3 Streaming Video or Rails HTTP Streaming
- muliple rails app in one server
- time select not loading into database
- undefined method `all' for {:conditions=>{:retailer_id=>[1, 2]}}:Hash In rails Engine
Rails - how to place text onto an image within a code loop Posted: 26 May 2016 06:53 AM PDT I'm building an events site using rails. For my index page I have a code loop showing an image, the event title and the date for each event. I need to show the title and date ON TOP OF the image. The code blocks for the title and date are wrapped in h2 and h3 tags respectively. I'm not entirely sure how to style this properly. My html page is set out as follows - index.html.erb - events My CSS for the image section is as follows - Events.css.scss What do I need to do to place the text elements of this code loop onto the relevant image? |
Best practice for waiting for image processing? Posted: 26 May 2016 06:59 AM PDT I've got a model that uses Carrierwave and CarrierwaveBackgrounder for image processing: So when an resource gets created I would like to wait for the Backgrounder to finish processing the image and then redirect to the newly created resource. All I can think of now seems very dirty to me: But that could maybe even cause timeouts. Any other/better suggestions? |
ActiveRecord accessing database when there are restrictions Posted: 26 May 2016 06:44 AM PDT There is a postgres db server A, which has access only from one node B. But any computer is able to access and login to B. How do I establish connection using ActiveRecord to the db server A from any node (which is not B) in a Ruby script? |
How to check elasticsearch tokens after running a query in Rails? Posted: 26 May 2016 06:44 AM PDT My problem is the following: I run an elasticsearch query in a rails app using specific settings to my index and my search analyzer, the problem is that it doesnt return any results in the app, in the other hand when i try to run it directly from my elasticsearch docker, i have tokens returned. If i use these tokens in my app query, i get results... so this is my elasticsearch query: here is the query from my rails app to elasticsearch: the last query does not return any result, but if i try a query with the tokens returned by elasticsearch ('cour', 'guitar') i have expected results. So i guess there is a problem between rails and elasticsearch that i dont find... Can anyone help on that ? |
How to use rails act_as_sortable gem, with several belongs_to relations Posted: 26 May 2016 06:39 AM PDT I have an Image model, which uses activerecord-sortable gem to easily reorder images by position. My product model is linked to the image model, and can be re-ordered with config[:relation] option of activerecord-sortable. It works fine, but I now want to add a Shop model, with the same relationship as product, in which images can also be reordered. Here is my image Model Is there any way I can specify to activerecord-sortable that my Image model must use several relationships ? I have tried that : But it doesn't work |
RSpec Capybara - Request test. Need advise Posted: 26 May 2016 06:46 AM PDT Two things which i don't understand at all. 1) first example: visit path - fail and get path - pass, why? Visit - capybara and get - rspec helper, right? With get some_path_here -> test pass But with visit some_path_here -> 2) second example: after login as regular user, should not have menu like admin. It looks like no differense between user and admin |
Refactoring ruby code , nested loops for exporting to csv Posted: 26 May 2016 06:13 AM PDT I'm new to ruby, and I have to export information to csv. I wrote this code and I don't really like, don't know how can I refactored and get rid of the nested loops. my relations are like the following : Order has many moves, moves have many stops. and I have to export all of this to csv, so as a result I will have multiple lines for the same order! it's not a good quality code .. |
How to retry if jobs in cron fails? Posted: 26 May 2016 06:07 AM PDT I am using I am having some import services which daily download files from ftp server and parse them and store them to database. This services have to run daily so I have made a cron job for the same. Code: The Backoffice service calls two services one after the another which saves different data. In those services I have handled exception and made retries after 1 minutes and after 3 retry counts I send a failure email to admin. My question is I want to delay the failed service after specific interval of time say 2 hours. So, how do I schedule or delay that job if some service fails for that same service. Note: I can't make retry in rescue block to be 2 hours as other services would be stuck. How do I achieve this task using whenever gem, or is there another gem that would help me achieve this task. Any suggestion on how to resolve this problem would be of great help. Thank You! |
Rails - eager loading with has_many_through association Posted: 26 May 2016 06:41 AM PDT I have a very simple has_many_through association as follows: In the index of my retailers controller, I want to display a list of all the retailers with their associated tags. If I just have in my controller I can solve this issue using Postgresql directly and it works fine, but I would like to understand how to do it in Rails. When I do What am I doing wrong? Thanks for you help |
Sidekiq Redis database keys increasing over time Posted: 26 May 2016 05:52 AM PDT I am currently using Sidekiq with my Rails app in production along with an ElasticCache Redis database. I've noticed recently that when monitoring the CurrItems metric using the AWS tools, I see the number of items gradually increasing over time in an almost step-like way: However, when I look at the jobs in queue in the Sidekiq dashboard, I don't see anything backing up at all. I see 0 jobs in queue, 0 busy, 0 scheduled. The step-like increase seems to happen at a very particular time each day (right at the end of the day), which made me think it might be related to a chron job/clockwork process I have running. However, I only have 4 jobs that run once a day and none of them run during that time or even near that time. Just for good measure though, here is my clock.rb file (I have shorted all the job descriptions and class and method names for simplicity's sake): I'm not quite sure where this is coming from. Maybe Sidekiq isn't removing the keys from the database once the job is complete? Another potential helpful piece of information is that I'm running 4 workers/servers. Here is my Redis configuration: Anyone know why this could be happening? |
rails - how to translate what is within a ruby code in a form format? Posted: 26 May 2016 06:15 AM PDT I have a ruby code. And I want to translate the English word "Email" to Japanese word because I am currently internationalizing my website written in English. I tried the following. However, it did not work. What should i do? |
ActiveRecord::StatementInvalid (NoMethodError: undefined method `query' for nil:NilClass: ROLLBACK) Posted: 26 May 2016 06:12 AM PDT I have admin control with devise. Admin can create multiple clients with one unique email and password for devise authentication. For each client, new schema will be created with client id e.g. apple_client_1 with 5 fix client related tables. When client log in with this email and password, transactions of their 5 models/table will be stored in their own database. So we have to manage 2 database, first is global database for authentication of admin and client and other local database for that particular client. So how can i manage it? after_create :create_client_schema |
Rails multiple objects select box Posted: 26 May 2016 06:40 AM PDT I have an index page where I am listing out all the objects(post) from a collection of objects(@posts) which has come from a post controller. I want to add a checkbox to each of those post objects so that the user can select which one of these objects they want to export via an export controller I have created. How can I setup a form so that it posts the selected object id's to this export controller? Thanks in advance. |
How to install nokogiri 1.6.7.2 on windows Posted: 26 May 2016 06:13 AM PDT I have gone through various links on stack overflow but don't get the solution to install nokogiri 1.6.7.2 gem with ruby 2.3.0 I have installed ruby 2.3.0 along with the DevKit. Still I am unable to run bundle install command it always show below error. "An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue. Make sure that I have run following devkit commands: Its run successfully and all ruby versions show. C:/Ruby200 C:/Ruby22 C:/Ruby23 Though I have installed ruby 2.2.4 also but still when run bundle install it shows: ERROR: Error installing nokogiri: nokogiri requires Ruby version < 2.3, >= 1.9.2. I am using windows 7 32-bit system. Due to this issue unable to install bundle. Please help. Thanks in Advance |
"no implicit conversion of nil into String"in the Search Module of Redmine Posted: 26 May 2016 05:02 AM PDT On the redmine of my company, there is this bug where I get an internal error if I want to search into a project. Here is the log corresponding to the error: The lines corresponding to the error in the controller are : Here is my config : What is interesting is that when I search only one letter, i'm redirected on the search page, but I don't have an internal error. I'm very new to Redmine developpement and to Ruby, I was just assigned to try to fix this bug. Do any of you have an idea of how to fix it ? Thanks. |
Getting location(city, state) from ip_address for bulk data with rake task Posted: 26 May 2016 04:54 AM PDT I have an x users with their last_sign_in_ip, can i get their location details using their ip_address with rake task? I am using rails and geocoder gem. |
undefined method `each' for nil:NilClass in update method Posted: 26 May 2016 06:14 AM PDT I have an Audi model in my ruby on rails application in which there are many fields like model, variant, car image, exterior, interior, brochure etc. When I try to update some attributes(not all), then it gives undefined method `each' for nil:NilClass in exterior and interior image section. More specifically, the issue is here: update method: Request parameters : |
How to update form fields real time in rails [on hold] Posted: 26 May 2016 03:58 AM PDT I have been building a CMS for our business application and I have been wondering if there are ways / what the best practices to update form fields in rails in real time? I find out that there are many long forms in my application and users often forgot to hit the save button. I have been looking at gems like |
How to split Devise edit page form into two pages? Posted: 26 May 2016 05:20 AM PDT I'm trying to figure how to split form from Devise edit page into two pages as it has too many fields right now. So the goal is for users to be able to update their profile information from separate pages. I'm fairly new to Rails so I don't understand what's going... I haven't created new controller for this purpose, I'm using existing Devise controller... The error I'm getting is that there is no edit_profile action defined in Registrations Controller even though there is.. What I did: Created a new view style.html.erb with a form and it's under registrations views. I just copied to form from existing edit.html.erb Added this to routes: Here is my registration controller so far: |
Posted: 26 May 2016 03:36 AM PDT I have cleared the first round of quicl kChex, they have given me a test. Do any one have any idea how we can do that, such searching algorithm. |
Refreshing partial div's with java on a set interval Posted: 26 May 2016 04:14 AM PDT I have one partial on my index.html.erb with sql query from a remote database and another one with csv read from file. Both partials are auto refreshing with java script, but only sql partial refresh works correct and keeps refreshing data, csv partial does not update values till the full page refresh. Chrome console Network section shows that both partials keeps refreshing on set interval with status 200(ok). Why does csv partial not updating the values? Aaaa controler: script for csv partial: console: |
how to get the id of the @mentioned_name from the Jquery at-who plugin Posted: 26 May 2016 03:06 AM PDT I'm working on a small project with ruby 2.2 and rails 4.2. I'm trying to implement the @mention_name feature like Facebook. I'm using the following for the same https://github.com/ichord/At.js Now to load the data to the plugin i use an instance variable say @username. which is hash of user_id and user_name. i iterate over the object and load the data of plugin with @username.values. what i want is when i use @ in the text area i have to store the ids of the users who where selected and on submit i have to store the user_ids in the db field say custom_sharing_ids I have implemented till showing the drop down and selected the usernames from the list of names. And this is my .html.erb file which gives me hash {1 =>"A", 2 => "B"}. now when i select say A, i have to pass the user_id "1" to the controller and save. Any help on this will be appreciated. |
Date.today updation issue in rails and postgresql Posted: 26 May 2016 03:39 AM PDT I have rake task which is having following line: which gives in console
but in Postgresql database : how this date is getting -1 day when it is updating in database? |
Ransack sorting associations one to many Posted: 26 May 2016 06:09 AM PDT I was able to make the search associations works, but the sorting didn't work the same way: example from my model:
and the link to the sort is correct. and I have to mention that, my case is not one to one, like Update: I have a grid and I want the sort to be based on |
Rails- paperclip- NoMethodError Posted: 26 May 2016 03:30 AM PDT I'm trying to make a movie review app in rails. This includes adding movie image and text fields. I'm using the paperclip gem for image upload. I am getting this error while adding movie. NoMethodError in Movies#create I am rendering a form partial in my movies/new,html.erb. Following is code snippet from movies/_form.html.erb Movies Controller PS: I have added image parameter in the movie_params method which is their in the private section- Following is the code snippet Movies Model Category Model |
AWS Opsworks executing deploy hooks in "setup" stage Posted: 26 May 2016 02:15 AM PDT I am setting up a rails 4 app on AWS opsworks. When I boot up an instance, I see that the deploy hooks are running in the "setup" lifecycle event of opsworks rather than the deploy event. I am facing problems in running asset precompile because of this. I cannot get expected behaviour because these callbacks happen in the setup lifecycle. Any help is appreciated. |
Rails 3 Streaming Video or Rails HTTP Streaming Posted: 26 May 2016 06:43 AM PDT I recently implemented JP video player or J Player in my Rails 3 app to stream video tutorials, but issue is video is not streamed in chunks means if size of video is 100MB then after that 100MB gets downloaded on browser then only video will play. To overcome this issue i have implemented http streaming using this rails cast http://railscasts.com/episodes/266-http-streaming Even then the video is getting fully downloaded. I am not able to understand what wrong i have done. When i am using curl -i command it shows me Transfer-Encoding: chunked but it is not working as youtube or other video sites work. |
muliple rails app in one server Posted: 26 May 2016 02:11 AM PDT I have a server with 20Cores / 40Threads. I used to have only one website app (rails / unicorn / nginx , 40 workers) on it and everything was working well recently I added a new website app (rails / unicorn / nginx, 2 workers) and since this, I have much less requests for my first website. htop stats seems to be normal. How can I find out where is the bottle neck ? Maybe it is link with network, as my second apps is making external requests ? Or maybe IO access as my second apps is also reading and writting in the ssd disk thanks |
time select not loading into database Posted: 26 May 2016 02:10 AM PDT i am trying to add a set of hours to my database as can be seen below, though i am getting the follow error. from the looks of the logs it also appears that it is the complete date time string, though i only want time migration form |
undefined method `all' for {:conditions=>{:retailer_id=>[1, 2]}}:Hash In rails Engine Posted: 26 May 2016 06:07 AM PDT
|
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