How to iterate through an array with React (Rails) | Fixed issues |
- How to iterate through an array with React (Rails)
- Sort rails results by price
- Getting the individual checkbox value in JQuery
- Creating a class namespace from a variable
- Using .where in Rails Controller Method
- Ansible error when doing bundle task
- Rails error - Booking unsuccessful
- Rails 4: how do I generate an error message in login view?
- Why do I receive usage info when trying to run bin/rails db:create?
- Method for destroying activity
- Multiple upload paperclip error
- Initialize multiple selections in select2
- Bitbucket Authentication failed on pushing existing project
- Using assert_select div to test for the number of error messages
- Rails, minitest: How to test the output of a controller
- Relation passed to #or must be structurally compatible. Incompatible values: [:references]
- Rails password protected page with custom lock screen and no redirects
- How to show current user's tag_id on a page called map while using ROR?
- Connection reset by peer - SSL_connect error in production when using Bitly
- Ajax Bad Request 400 Rails
- model Shop::Product looking table shop_products. Why?
- Quotes role in setting ruby code inside javascript variable
- Google translate free api resposne to JSON Array in ruby
- Max years allowed parameter for credit card field
- Ordering ActiveRecord instances according to their children's specific attributes
- Selecting one of a has_many relation in Rails
- How to create multiple submit buttons with different formats in a form
- Rails rails-money undefined method `cents'
- Rails 4 - Combining scopes in a DRY manner
- Does sidekiq use any dependent application to initialise its processes?
How to iterate through an array with React (Rails) Posted: 22 Nov 2016 07:49 AM PST I just started to learn React and I am trying to figure out how to find a specific value I am looking for. Just like you have the each.do method in Ruby and you can iterate through an array, I'm trying to do that with React. I am trying to access the thumbnail._url and when using the debugger, I am not able to access all the objects and images. I thought of this.props.gallery.object.thumbnail_url and other ideas but I am not really sure of the best way! |
Posted: 22 Nov 2016 07:40 AM PST I'm wanting to sort this: via search_price (a column that sits inside the However in my view i have this: Which didn't return a low price, It returned a random price in the middle (low price being 69.00 and it returned 103.00) Any ideas? Thanks |
Getting the individual checkbox value in JQuery Posted: 22 Nov 2016 07:47 AM PST I have several checkboxes and have a JQuery function that I want to print out the value I give each checkbox when I click on the checkbox. However, 1 keeps printing out. I assign each checkbox an item.id based on a primary key from my db using Rails. Here is my code In the image I am trying to print out the number by the checkbox(item.id), but in the console it only prints out 1 |
Creating a class namespace from a variable Posted: 22 Nov 2016 07:40 AM PST Is there a way I can compose a class namespace from a variable? For example, let's say I want to catch an exception that is inside Would that be something like |
Using .where in Rails Controller Method Posted: 22 Nov 2016 07:18 AM PST I have a Statistics page and currently have an items_controller: statistics.html.erb |
Ansible error when doing bundle task Posted: 22 Nov 2016 07:01 AM PST I am trying to set the env variables with export in ansible, bundle install works but when i do the bundle exec rake db:reset i am getting this error the code looks like this i tried the environment module but it had same error so i changed it to export. How can i achieve the environment variables set dynamically? what is the error i am getting? I logged into the ec2 instance and did export of env variables and did bundle exec rake db:reset and it works there. |
Rails error - Booking unsuccessful Posted: 22 Nov 2016 07:03 AM PST I'm building an Event app using Rails. I've recently changed around my bookings controller to accomodate events which are free. This side of the app seems to work fine but when I try a test booking for a paid event the app defaults to 'booking unsuccessful' after I complete the payment submission form. I'm not really sure why this is happening. Here's my controller logic - And in my model I have this - Booking.rb So, for some reason its not saving or there's something else not right. Any assistance appreciated. |
Rails 4: how do I generate an error message in login view? Posted: 22 Nov 2016 06:54 AM PST Here in the login view I have this code: and if I enter incorrect user information it should give some notice from the controller: but instead it just reloads the login page with no notice or error message whatsoever. I'm new to Rails, do you have any idea what I can do? |
Why do I receive usage info when trying to run bin/rails db:create? Posted: 22 Nov 2016 06:15 AM PST When I try to use I'm using chruby with version 2.3.3 and Rails 5.0.0.1. The goal here is just to create the databases....what's going on? |
Method for destroying activity Posted: 22 Nov 2016 07:31 AM PST I am using the acts_as_votable and public_activity gems, and want to remove activities when posts are 'unliked'. The public_activity docs specify using For anyone familiar with the public_activity gem, have you ever run into this issue and how did you solve it? |
Multiple upload paperclip error Posted: 22 Nov 2016 07:07 AM PST I m trying to implement multiple upload images for my app with paperclip like this link Actually simple upload work, but if I try to implement an array I have an error.
campings_controller.rb _edit.html.erb camping.rb |
Initialize multiple selections in select2 Posted: 22 Nov 2016 05:53 AM PST I'm developing a multiple selection in Select2 4.0 and Rails 4.2.7.1. The code saves the right value in the database, but I've noticed a problem: it loses all value selection after a failed validation. How could i initialize all the value previously selected after a page reload? Thanks. This is the current select2 declaration: |
Bitbucket Authentication failed on pushing existing project Posted: 22 Nov 2016 05:57 AM PST This is the error on my terminal: This is what I did: then it asked for my username and password then the error showed up |
Using assert_select div to test for the number of error messages Posted: 22 Nov 2016 05:45 AM PST I am trying to test for the correct number of error messages on a page using assert_select but I am not sure what the appropriate div.alert combination is. |
Rails, minitest: How to test the output of a controller Posted: 22 Nov 2016 06:12 AM PST My controller looks like this: I wrote a Test like this: This test passes. Now, I want to write a test, to check, whether the output is correct. I tried this: But this error occurs: How do I test the output of the controller? ( In my case @worktime) |
Relation passed to #or must be structurally compatible. Incompatible values: [:references] Posted: 22 Nov 2016 05:06 AM PST I have two queries, I need an First query is a simple Second includes a I tried to combine these with Rails' But I keep running into this error and I'm not sure how to fix it. |
Rails password protected page with custom lock screen and no redirects Posted: 22 Nov 2016 04:28 AM PST Squarespace has a nice lock screen mechanic that I am trying to duplicate in my rails app: User navigates to url (e.g. http://localhost:3000/customs) but page is locked so user sees lock screen (icon and password input field below the icon - no username field, just password). URL remains the same even though the page is locked (i.e. no redirects) User enter's the password, the lock screen fades out and the page content fades in all without the url changing. Password is saved until browser cache clear so user doesn't see lock screen upon re-entering URL at a later date. I can't work out how to do this in my rails app. The app uses sites wide Devise user login for authentication but require's signup and view (url) redirects which I am keen to avoid for this page. I have also tried http authentication but would ideally like a full page (and customisable) lock screen. Any ideas much appreciated |
How to show current user's tag_id on a page called map while using ROR? Posted: 22 Nov 2016 07:13 AM PST I am trying to show the current user's tag_id and the datetime of the detection on a new page(index.html.erb) that is in a folder called map in the views folder. I have tables called detections, lendings, users, and rfid_tag. these are the relationships. User: RfidTag (has a tag_id): Lending: detection (has the datetime): How can I do this? |
Connection reset by peer - SSL_connect error in production when using Bitly Posted: 22 Nov 2016 04:01 AM PST I am using bitly url in my application in 2 cases. In one case I am using it through jQuery as: and in other case I am using bitly gem with version 1.0.2. For this I am adding view: controller: the above 2 are working fine in development mode and rails production mode and I also tried in AWS EC2 instance with Apache and Phusion, it is working great but it is not working in the main production server where the domain name is mentioned in the url with "https". These are the errors I am getting:
The url mentioned in show is coming from js file as mentioned above. Please help me to get out of this error. |
Posted: 22 Nov 2016 04:07 AM PST I'm getting bad request error 400 using Ajax on Rails. When i submit my form I have a string to send as parameter from Jquery and i want to retrieve it from params[:assignee] so i can extract the string and save it through my controller. My controller: And this is my JS: assignee is an username selected in a jquery auto-complete form: My root is "task/" where you can see saved tasks and a form to create a new one. I searched a lot on the net and I tried them all. How can I do? Thanks so much |
model Shop::Product looking table shop_products. Why? Posted: 22 Nov 2016 03:39 AM PST I have following model models/shop/product.rb I generated migration I create new product and display error UndefinedTable: ERROR: "shop_products" |
Quotes role in setting ruby code inside javascript variable Posted: 22 Nov 2016 03:24 AM PST I am trying to set a javascript variable to link_to rails helper like this: It works great like this, but the problem is that I get this link_to as a string from ajax request and the single quotes around are replaced by double quotes and vice versa. My result string is: Of course, it doesn't work as expected (link isn't generated, the string remains just a string). How do I fix this quotes problem? |
Google translate free api resposne to JSON Array in ruby Posted: 22 Nov 2016 05:38 AM PST I'm working on a simple API in ruby on rails, which will connect with Google translate API (using the simple trick to get a response for free) and process the output. My request looks like i.e.:
and responses I'm getting from Google server is as follows (can't get a json formatted response, as setting client to 'p' no longer works)
In java I can easily process that response by creating a JSONArray object, however I can't find a way to do so in my ruby on rails app. I'm using rest-client to make a request and last line fails with
Is there anyway to process a response like that? Ideally to break it into JSONArray, but will be happy to see any neat solution. Thanks, |
Max years allowed parameter for credit card field Posted: 22 Nov 2016 04:27 AM PST I am working in a rails application in c9. In my project I entered the credit card fields with this code at the end: I get this error message: There are too many years options to be built. Are you sure you haven't mistyped something? You can provide the :max_years_allowed parameter. How is this :max_years_allowed parameter written in code to bridge this problem? Any expert advice? |
Ordering ActiveRecord instances according to their children's specific attributes Posted: 22 Nov 2016 05:31 AM PST I have two ActiveRecord models -
I've also defined an instance method for residences I am able to sort residences in ascending/descending order with calling this scope. What should I do to sort residences by their minimum apartment price? UPDATE: i've found a solution with pure sql, now need to translate it to AR P.S. I am aware of other related questions and answers on SO, but none of them helped me. I am also aware of to implement a frontend based solution, with passing such values to |
Selecting one of a has_many relation in Rails Posted: 22 Nov 2016 03:16 AM PST What is the preferred way of selecting a specific record out of a has_many relation for a specific model in Rails? (I'm using Rails 5.) I have a model What I want to do is to allow a |
How to create multiple submit buttons with different formats in a form Posted: 22 Nov 2016 03:35 AM PST Hi I'm working on a project in which I have a form which consists of a list of posts each with a checkbox and two submit buttons. One submit button is view, which takes the user to a template containing all the posts checked. The other is a delete button, which should keep the user on the page, delete the posts and refresh the list. The problem is that I need to be able to change the submit format depending on which button the user pushes, HTML for view and js for delete. Originally I had: for just viewing, but obviously that wont work for deleting and I'm not sure how to change it to work. Any help would be great! |
Rails rails-money undefined method `cents' Posted: 22 Nov 2016 02:26 AM PST I am attempting to implement money-rails and I have run into the following error:
I followed this tutorial to get a "fancy" currency input field. DB schema: Model: Form: Controller: Should I be setting up the :balance input field another (better) way? |
Rails 4 - Combining scopes in a DRY manner Posted: 22 Nov 2016 04:27 AM PST Lets say I have this 3 scopes: Now let's say that I want to make a scope that joins those 3 categories. I am doing it right now like this: While this works, it has some disadvantages. if I were to change the conditions of one of the 3 categories, I would have to rework the scope that contains them all as well. Something like this seems more DRY: But this is not valid code. Is there a way to code it in such a fashion? UPDATE I know I have used an example using categories and ids, but please do not make it about it. It is about merging scopes. UPDATE 2 I have changed the name of the attributes from |
Does sidekiq use any dependent application to initialise its processes? Posted: 22 Nov 2016 02:28 AM PST I am trying to understand how sidekiq works. Does sidekiq load all the dependencies via the rails initializer by loading all the gems or does it use some sort of an applications server while spawning its workers? |
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