nokogiri wont parse the file using SAX handler | Fixed issues |
- nokogiri wont parse the file using SAX handler
- Ruby Minitest: Access variables in setup-method
- Storing user generated scopes / segmentation of model
- Ubuntu development configuration with SSL, Puma, and Rails
- Test if a method is called inside a module method
- Outputting content onto rails website from Third Party API
- Rails Spree shipping.
- Specify Unicode Character in Regular Expression
- How do I display an image from an attachment?
- Cannot install gem march_hare
- Ruby on Rails - Default ascending sort bootstrap table for the filtered column
- Get values from Javascript object in Rails controller
- Rails form with dynamic test bank
- data must be a two dimensional array of cellable objects
- Slimpay Illegal state Error when try to call orders.get_mandates method
- Difference between broadcast , broadcast_to and broadcast_for in rails 5
- Why is this map not working?
- Selenium does not execute javascript
- How to use two different method with the same "name" from two different gems on the same rails model?
- LIKE query with MySQL always return nil
- How do I count within nested resourced and display the results?
- Rails eager loading associations
- Developing API using Rails 5.x
- Rails: build in certain order
- JavaScript append Rails erb code
- Too may redirects rails respond_to
- JSONAPI testing with rspec and Airborne
- How to create force-directed graph of each individual area?
- form_for > f.submit, How to only alert at update action.
- How to view rails/routes for a rails engine in the browser
nokogiri wont parse the file using SAX handler Posted: 23 Jan 2017 07:41 AM PST I have xml file with header and also it contains the when used the SAX parser it wont parse. But when manually removed the encoding part and the attributes after transmission;XML parsing success. Being the file is large;I cant use only SAX.Is there any other way to parse this xml file without manually removing the encoding and transmission attributes. |
Ruby Minitest: Access variables in setup-method Posted: 23 Jan 2017 07:35 AM PST How can I access variables that are defined inside the setup method in Minitest? If I run this |
Storing user generated scopes / segmentation of model Posted: 23 Jan 2017 07:26 AM PST I'd love to hear what people think might be the best practice for this. I have users which can manage a list of customers. I want them to be able to segment their customers. For instance a segmentation can be customers who have in the last 5 days purchased an item. Or customers who have not purchased an item at all. Ideally i'll allow the segmentation to follow several conditions such as: Customers who have purchased an item in the last 5 days AND was registered less than 2 days ago. How would you go about setting this up and storing it? I can set columns for each condition, but conditions might have different variations in what scope they use. Furthermore it doesn't work if you want them to be able to set several segments. Another idea is to use serialization, if so any thoughts on how to do this? |
Ubuntu development configuration with SSL, Puma, and Rails Posted: 23 Jan 2017 07:26 AM PST Goal: get ssl working in development mode (ssl works fine in production on heroku) My setup: Ubuntu 16.04 Rails 5.0.1 Puma 3.6.2 config/environments/development.rb I tried following along with this puma ssl how-to: https://gist.github.com/tadast/9932075 (I am not sure what github procol is regarding pasting above link content here vs referencing it) if I then use the command line method to run puma I am getting Chrome's 'Not Secure' error when trying to access via the browser after attempting to add certificate to ubuntu. Should I should see 1 added here? I also tried copying server.crt to /etc/ssl/certs If I proceed past chrome block I get console error: Instead of using puma on command line I tried adding to config/initializers/puma.rb and starting: rails s I do not get any page load but console shows: HTTP parse error, malformed request (): # 2017-01-23 10:04:43 -0500: ENV: {"rack.version"=>[1, 3], "rack.errors"=>#>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"puma 3.6.2 Sleepy Sunday Serenity", "GATEWAY_INTERFACE"=>"CGI/1.2"} I also tried downgrading puma to 3.5.2 Where am I going wrong? |
Test if a method is called inside a module method Posted: 23 Jan 2017 07:23 AM PST I have the following in my module: I would like to test these "if conditions", to ensure that the right methods are called (all these methods are from With both answers created I go to the right What am I doing wrong? |
Outputting content onto rails website from Third Party API Posted: 23 Jan 2017 07:23 AM PST I am using the HTTParty Gem to access data from a third party API. I have set up the model to successfully retrieve/parse the data from the other website. What I do not know: What code is required in the controller to allow me to display the content in the view (and ultimately the website). Here is my code for the model file called representatives.rb Here are my Json results: So what do I need to put in the representatives_controller.rb as well as the view files at this point? Thanks |
Posted: 23 Jan 2017 06:53 AM PST |
Specify Unicode Character in Regular Expression Posted: 23 Jan 2017 07:30 AM PST How can I create a ruby regular expression that includes a unicode character? For example, I would like to the character "\u0002" in my regular expression. |
How do I display an image from an attachment? Posted: 23 Jan 2017 06:46 AM PST I'd like to display an image, that I uploaded with CarrierWave, in the following code block. And ow can I define the image size? |
Posted: 23 Jan 2017 06:17 AM PST I tried adding this to my Gemfile: Using On the topmost line in my Gemfile, I have this : When I manually visit the rubygems and I m able to find this gem here : https://rubygems.org/gems/march_hare How do I install this gem? I don't understand what is happening. |
Ruby on Rails - Default ascending sort bootstrap table for the filtered column Posted: 23 Jan 2017 05:57 AM PST I'm a newbie in Rails, I want sort data in some code and I stuck... I have a problem with the default sorting (ASC) on my bootstrap table. I want to sort data by the 'Expires' column, but I'm not sure how in case of filters add attributes which will refer to only one column. Data-field added to the %th makes the whole table filled with dates... Can somebody help me? _index.haml users_helper.rb |
Get values from Javascript object in Rails controller Posted: 23 Jan 2017 06:45 AM PST I'm fairly new to Rails but I have a situation where a user can create a vacancy and select modules for that vacancy by dragging en dropping modules. Everytime something has changed (a module has been added/removes to the vacancy of the order has changed) I send a javascript object to the rails controller through AJAX and I want to extract the values from this object and story them in my DB. My object will look like this: In my controller I would like to go through every module and extract their module_id, name, etc. AJAX block: Is there a way to do so or is there a better solution? |
Rails form with dynamic test bank Posted: 23 Jan 2017 05:33 AM PST I'm looking to create a question bank where the test creator can specify the number of question they would like to see for each category of the form. Currently I loop through all of the question to build the form, and I'm not sure how to simply pull out only x number of questions per category. Table structure: |
data must be a two dimensional array of cellable objects Posted: 23 Jan 2017 05:29 AM PST I'm trying to print some data in a table using a condition, but it returns the following error: data must be a two dimensional array of cellable objects |
Slimpay Illegal state Error when try to call orders.get_mandates method Posted: 23 Jan 2017 04:55 AM PST When i try to call get_mandates method of Slimpay using 'https://github.com/novagile/slimpay' Gem it is giving me 903 Ambiguous handler methods mapped Error(http://prntscr.com/dz8goe). |
Difference between broadcast , broadcast_to and broadcast_for in rails 5 Posted: 23 Jan 2017 04:51 AM PST From the Rails Guide I found following three code snippets This simple broadcast sends the data to a specific chat room while Here is another type of broadcast broadcast_for - for which i couldn't get any example . My question is what is actual difference between these three and when to use each of 'em - thanks in advance |
Posted: 23 Jan 2017 04:42 AM PST I have a list of If I add a What am I doing wrong here? |
Selenium does not execute javascript Posted: 23 Jan 2017 04:46 AM PST I am using capybara with Selenium as its driver. I am trying to click on an element, which when clicked it will reveal a div, but the click never invokes javascript to do just that. Below is the code I have error message
html javascript code to execute While i can see the link being clicked, the underlying javascript is not executed. |
Posted: 23 Jan 2017 05:10 AM PST The app (rails 4.2.7) i'm working on uses both The Now, for background processing of Both of these gems exposes I'm getting this error while trying to access any page on the app.
Any help will be greatly appreciated. Thank you! |
LIKE query with MySQL always return nil Posted: 23 Jan 2017 04:05 AM PST First of all, I'm using rails 4. What I'm trying to do is search some usernames in my MySQL database. But whatever my query is, @search is nil, and the result is 404. Here's my code. I tried several changes with my params[:query] such as "%#{params[:query]}%" or just params[:query] with out "%". But it still didn't work Any help will be appreciated. |
How do I count within nested resourced and display the results? Posted: 23 Jan 2017 04:06 AM PST I am building a job board in rails based on PostgreSQL. I want to count and display the amount of job offers per employer on the index of the employer page. What is the code for this kind of count? I created a nested resource, and associated my employer and offer model, by: |
Rails eager loading associations Posted: 23 Jan 2017 04:14 AM PST I have two models I have an attribute I am getting
and when I try I am getting
In the rails console I can see that the SQL generated for is
What am i doing wrong? thanks in advance |
Developing API using Rails 5.x Posted: 23 Jan 2017 03:30 AM PST I need to develop a Rails based API which takes in a JSON input with parent and child data (Customer and his Cars), and stores them in User and Car tables respectively. I am currently learning from Developing API using Rails 5 However, the above example uses two Controllers for each table. I need one single Transaction. Are there any resources to learn how to save in multiple tables in one block using Rails 5 API ? |
Posted: 23 Jan 2017 03:12 AM PST I create two addresses home address and semester using build, nested attributes and fields_for like below and the form looks like this Now the problem is, if a user only add semester address, not home address during the registration, then when that user tries to edit the address, semester address shows first and then home address after that. But for me, the order is very important. So I have to show home address first even if it blank and then semester address. How can I do this? Edit: I figured the above thing may not be clear. So here is another relevant example of what I need. If I have a new action like this and in the edit action I try to add more addresses as below This does not build in order as I expect. Instead if a user home address and semester address build first since they are already in database and the new office and parents address build later since they are new builds. But I want them to build in the order. How can I do this? |
JavaScript append Rails erb code Posted: 23 Jan 2017 03:36 AM PST I got a complicated I've written some code following html js But it seems to fail, I am not familiar with JavaScript, is it wrong with the syntax? |
Too may redirects rails respond_to Posted: 23 Jan 2017 03:11 AM PST I have a controller action method that gets all records of establishments from the DB, I then want to share this response with a external entity which is a RhoMobile application, i used respond_to to format the response to JSON. When i navigate to this action i get an error
in chrome developer tools on the console tab. When i remove the
instead and when i refresh the page i get the expected view. |
JSONAPI testing with rspec and Airborne Posted: 23 Jan 2017 02:56 AM PST Hello i have problem with testing JSONAPI with rspec and airborne. GET model below https://i.stack.imgur.com/Cyf75.png Im testing it this way https://i.stack.imgur.com/Y9rHt.png Rspec output: Failures: 1) GET on /contacts should validate types Failure/Error: expect_json('books.0', title: 'The Great Escape') Finished in 0.03121 seconds (files took 0.17681 seconds to load) 1 example, 1 failure |
How to create force-directed graph of each individual area? Posted: 23 Jan 2017 01:55 AM PST I am fairly new to rails and to D3.js but have been working on creating forced-directed graphs. I would like to know if anyone can help me find a way to make force-directed graphs for individual 'areas' or 'groups'. So for example, I have 6 groups of devices in a network, I am displaying these in one big graph (or topology) but I would like to also display each group individually as its own graph on separate pages. This is as far as I have got but the @links section does not work as it should and I am stuck for ideas. This may be a stupid question, so I apologise but any help would be greatly appreciated. Many Thanks Faye |
form_for > f.submit, How to only alert at update action. Posted: 23 Jan 2017 01:35 AM PST How would one set this up so it only pop's up at update action and not create?
|
How to view rails/routes for a rails engine in the browser Posted: 23 Jan 2017 02:32 AM PST I have a rails engine, which is mounted in In the engine, I have a number of controllers, and when I start a rails server in the dummy directory these routes are active e.g. /handicap/tees/index responds. However, when I go to I can list them using |
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