Date not showing in rails app when requesting year field | Fixed issues |
- Date not showing in rails app when requesting year field
- Rails controller - execute action only if the two methods inside succeed (mutually dependent methods)
- If condition not processed as expected in rails
- Testing cancan permissions
- Nested render is not called after render partial in controller
- How to push object into relation collection in seeds.rb
- How add nested attributes in seed file
- [RAILS][Javascript] Is it "clean" to use controller variables in javascript ?
- Rails/Ckeditor howto change height?
- Incomplete response received from application Rails 4 Passenger error
- Slug error with Heroku
- Create record on click with ajax
- Move chart.js function from partial to assets folder in .coffee file
- How associate order with a current_user?
- Searching in scope for first name, last name or fullname in Ruby on Rails
- Rails error with make_flaggable
- Agile Development with Rails 4, Chapter 10 - playtime section: Misunderstood code
- Rails make_flaggable error cant flag
- ActiveModel::Serializer Shared include list
- rails foreign key setup with AR and postgres
- Rails migration to change empty strings to null
- before_create method in model not working - Rails4
- Teaplix Inventory CSV Order is not importing
- How to connect to remote machine in Ruby with "raw" connection type like in PuTTY?
- SMS verification after devise login, how?
- Showing first picture in each category on Rails app index page
- Devise Invitable how to provide user to set the password
- is there an Ajax version of Datagrid gem for Rails
- Ruby not edit or saving from a collection_select
- Rails 4 does not render my Layout
Date not showing in rails app when requesting year field Posted: 09 Jun 2016 06:59 AM PDT I have a data type called: And I have a select field: But i can't seem to display the year? at the moment I'm using: But nothing displays, I have also tried: But then get a error Any ideas? |
Posted: 09 Jun 2016 06:58 AM PDT I have a Controller with a method called 'actions'. When the app goes inside the method 'example_action', it implements a first method (1) update_user_table and then (2) another update_userdeal_table. (both will read and write database) My issue is the following: in case of timeout in the middle of the controller, I want to avoid the case where the User table (via method 1) is updated but the UserDeal table is NOT (via method 2). In my app, for mobile users if they're in a subway with internet connection, they launch the request that goes through 'example_action' controller, performs successfully the first method (1) but then they enter a tunnel for 60 seconds with very very low (<5b/sec) or NO internet connection, so for UX reasons, I timeout the request and display to the user 'sorry too long, try again'. The problem is that the "damage" is already here in the database:) => (1) was already performed but not (2). And in my app it is totally out of question to update the User table if the Userdeal was not updated (it would create data consistency issues...) I need the two methods (1) and(2) to be "mutually dependent": if one does not succeed, the other one should not be performed. It's the best way I can describe it. In practice, as (1) happens first, if (1) fails, then (2) won't be performed. Perfect. The problem is if (1) succeeds and (2) is not performed. How can I say to Rails, if (2) is not performed successfully, then I don't want to execute any of the things inside the block 'example_action'. Is that possible ? |
If condition not processed as expected in rails Posted: 09 Jun 2016 06:56 AM PDT I have my code as below Expected Output: But actual output is When I comment out the third As I am new to Rails, I can't figure out why only the last if statement is rendered. If I mix |
Posted: 09 Jun 2016 06:37 AM PDT I have the following permissions in my ability class for a limited admin user. Why does the test cases below keep failing?. Limited admin does not have the permission to manage all. He cannot manage Project. However, The test case below passes. |
Nested render is not called after render partial in controller Posted: 09 Jun 2016 06:29 AM PDT I created a partial in which again are partials. While I am loading this page on my own via a click on a button in the navigation everything works as expected. In a further step I update the DB via an ajax call. This works fine. Since the data is updated I want to display the change. So I do again an ajax call which routes to this controller But in the resulting page any render from the partial I have posted above is empty. What is wrong there? |
How to push object into relation collection in seeds.rb Posted: 09 Jun 2016 06:48 AM PDT I have three models: Match, Broadcast and Channel. Match and Channel are associated with In rails console it's possible to do How to add object to collection in seeds file? Edit:It was typo. I forgot to add |
How add nested attributes in seed file Posted: 09 Jun 2016 06:23 AM PDT I have model exhibit and exhibit have quiz. In quiz we have questions and answers belongs to it. I used nested attributes. Where I make mistake, because wright now after rake db:seed rails add me only last line in Question 1 Exhibit model: Question model: Answer model: |
[RAILS][Javascript] Is it "clean" to use controller variables in javascript ? Posted: 09 Jun 2016 06:50 AM PDT I'm having a little question about convention and bests ways of doing things in rails. Right now for a view I need to get an array of hash that I can construct way easier in my controller. I need this arry for my javascript code... So I far i found a solution that isn't an ajax request which is this one : I know that it's probably "better" of doing an ajax request or to store this variable in erb code... But I try to limit myself to do ajax requests (since this page already does a few ones) and I dislike creating hidden field to store my controller method... Anyway, if you could give your opinion/advices on this I would really apreciate it ! :) Best regards ! |
Rails/Ckeditor howto change height? Posted: 09 Jun 2016 06:05 AM PDT This may seem very stpd,sorry ...; rails4 /ckeditor/simpleform: somehow the body of a f.ckeditor text-area gets a style="height:200px", and I just can't find out where to change that size? Anyone a hint? thnx! |
Incomplete response received from application Rails 4 Passenger error Posted: 09 Jun 2016 05:46 AM PDT I have a Rails 4.2.6 application with Passenger 5.0.28 on Ubuntu 14.04 x64. After successful deployment using Capistrano, I can't open website. And I even can't find log files that will indicate the problem. After some research, I have found out that the most common problem is missing So here is my pretty simple apache config file: When I try to open my app In see the error: Incomplete response received from application Logs tail -f /var/log/apache2/* Error log is empty. My application logs in /var/www/my_server/current/log also empty So what I did so far:
Any thoughts? Where should I gather more information from server? |
Posted: 09 Jun 2016 05:52 AM PDT I have a site that works fine on my local host, but I have an error as soon as I try to create a new The Basics I have a model This is included in my model: And in my migration, add_slug_to_links: Not sure what's wrong. Any help would be appreciated. |
Create record on click with ajax Posted: 09 Jun 2016 05:27 AM PDT I have a list of elements, which should create or delete a record in a table when clicked. Each element has some data attributes associated with it to create/destroy the correct record. I am wondering the correct 'rails' way to accomplish this? Element list: |
Move chart.js function from partial to assets folder in .coffee file Posted: 09 Jun 2016 05:12 AM PDT I have text block in main page, it located in _about.html.haml partial. When I click the link, text replaces by radar chart via AJAX (I use 'chart-js-rails' gem). Now the js function located in _my-chart.html.haml partial (which replaces first one) & I think it's not good enough. So the question is: how to move this function code to assets folder in .coffee file or something like that? P.S. I already try to move it to 'chart.js' file & use views/welcome/_about.html.haml views/welcome/chart.js.haml views/welcome/_my-chart.html.haml controllers/welcome_controller.rb |
How associate order with a current_user? Posted: 09 Jun 2016 05:17 AM PDT I'm building a store that has items and orders for each user. Right now I want to associate each order with a current_user. That is, the one that is making an order. I figured how to associate models but I can't figure out what to write that will save user_id to order model upon the creation of an order. I'm using standard Devise engine. These are my models: Order.rb order_item.rb And in the user.rb I have: This is my OrderItemsController: |
Searching in scope for first name, last name or fullname in Ruby on Rails Posted: 09 Jun 2016 05:21 AM PDT I just started developing in Ruby on Rails and am trying to define a search scope in my User mode. With the following scope I am able to search for a user based on his first name or his last name: I can't get my scope up and running to search for the full name, I thought the following would work: But this returns
I understand that my database thinks that I am looking for a record in the database, but how can I tell it to look at the defined full_name above? |
Rails error with make_flaggable Posted: 09 Jun 2016 04:52 AM PDT When i try to flag something with: I get: My page_post model: My user model: |
Agile Development with Rails 4, Chapter 10 - playtime section: Misunderstood code Posted: 09 Jun 2016 05:44 AM PDT I am having a problem understanding a line of code in a suggested solution in the playtime section of Chapter 10 in Agile Development with Rails 4. For an exercise, I am supposed to create a unit test that adds duplicate products. The logic of the unit test is as follows: In the unit test, I should create a cart, add two of the same item (already declared as a fixture) to the cart, save the items then make assertions for what I expect the number of items and the total price should be. Below is the suggested solution. The problem is I don't understand this line nor its function: "assert_equal 2, cart.line_items[0].quantity". See the full test below. Thanks in advance! |
Rails make_flaggable error cant flag Posted: 09 Jun 2016 04:47 AM PDT When i try to flag something with: I get: My page_post model: My user model: |
ActiveModel::Serializer Shared include list Posted: 09 Jun 2016 04:38 AM PDT Using active-model-serializer, I have a model which references two of the same model type: (this is simplified code from my project) The problem I have is that when this is serialized into my API output, I end up with two lists in the JSON for each contact list. This is compounded by this model being included by a parent model which also has other Contact references. So I end up with several lists of Contacts in my API output, all duplicating basically the same set of Contact objects. Is there any way to convince the serializer to make all my fields use a common list of contacts in the response, rather than one list per "field"? |
rails foreign key setup with AR and postgres Posted: 09 Jun 2016 05:29 AM PDT I just realized I have some issues when deleting parent models. I have this setup: user.rb conversation.rb schema (postgres DB) As you can guess if To deal with this problem I'm planning to do the following: user.rb schema (DB): Is this the right way to solve this issue? |
Rails migration to change empty strings to null Posted: 09 Jun 2016 06:12 AM PDT Say I have a db table called fruit like this: I need to write a migration to change the empty strings to null without affecting Would it be something on these lines? Pretty basic stuff I guess but I'm kinda stuck here. What is the best approach here? |
before_create method in model not working - Rails4 Posted: 09 Jun 2016 04:45 AM PDT i am unsure why my boolean is not automatically being set to false when a company is created. could one kindly advise me why.
you help or advise would be much appreciated schema company.rbHave I written the Terminal controller |
Teaplix Inventory CSV Order is not importing Posted: 09 Jun 2016 05:08 AM PDT I am using Teaplix To import Inventory Quantity Upload. https://www.teapplix.com/help/?page_id=4720 CSV upload Everything i am grtting, but csv is not uploading Getting Error can some one tell which way i can upload inventory csv in teaplix |
How to connect to remote machine in Ruby with "raw" connection type like in PuTTY? Posted: 09 Jun 2016 05:20 AM PDT I want to communicate with remote printer which has IP "xxxxx" and port number "xxx". I am able to connect to printer through PuTTY and can issue the command to the printer and printer is executing those commands. Below are the images that describes the steps that I am doing to connect to printer and issue the command to it. As you can see in the above image I am using "raw" connection type. Above image shows the command that I am issuing to printer after connecting it via "raw" connection type. I want to connect to remote machine (printer) via Ruby programming language with "Raw" connection type as shown in the first image of PuTTY. But I am not able to do it. Also there are libraries for SSH and Telnet but there is no library that can connect to remote machine (printer) with "raw" connection type. I want to know how can I connect to remote machine (printer) with "Raw" connection type like PuTTY and issue the command to the printer. Thanks, |
SMS verification after devise login, how? Posted: 09 Jun 2016 04:08 AM PDT I am using devise for user authentication, how i can request from user, after clicking on sign in button, to enter sms code which is automaticaly sent to his mobile phone, for successful sign in. I followed some instructions from internet, also i made twilio and got API key, but still no idea how to finish this. |
Showing first picture in each category on Rails app index page Posted: 09 Jun 2016 05:27 AM PDT I'm learning Rails by building a small personal Ecommerce App. So far I have built a products page, category page, checkout page and so on. I´m able to upload pictures and assign them to categories through this product_form. Then, I can go to each category by selecting it in the _navbar.html.erb, like this. But the thing I want to be able to do is to display the latest uploaded picture in each category on the index page I´m not sure how to do that. This is what I have come up with so far, by displaying this code in the in and in the so my question is, how should I change the controller or the thanks in advance D |
Devise Invitable how to provide user to set the password Posted: 09 Jun 2016 03:12 AM PDT I am using Devise and devise invitable gem. If a invited user who doesn't accept the invitation and request a confirmation email using the same email address, the email is confirmed and the devise doesn't ask the user to set up the password. Which I think is not good. So, how to let the user to set the password. |
is there an Ajax version of Datagrid gem for Rails Posted: 09 Jun 2016 03:11 AM PDT I was tinkering with Mongodb (using mongoid adapter) with Rails and found out that it has less support in terms of data-tables than the standard active-record. While looking for datagrids / datatables generators, I have found a good one named: "Datagrid" https://github.com/bogdan/datagrid I looked at the documentation and it supported mongoid out of the box, but alas! It does not shipped with Ajax support out of the box. Does anyone know of any alternative or easier workaround to have datatables for Mongoid based model / table in Rails? |
Ruby not edit or saving from a collection_select Posted: 09 Jun 2016 06:48 AM PDT Please help The form does not save the collection_select and it does not edit _form.html.erb learners_controller.rb |
Rails 4 does not render my Layout Posted: 09 Jun 2016 03:56 AM PDT I currently mindblown regarding Layouts in Rails 4, as of now, i created a layout for my controller and it is successfully being called in my controller using the but the problem is, whenever i redirect_to that controller it only renders the page itself not the layout on top of it. here is my snipper of the code: Take not the redirect_to in my login_user function does render the layout. and this is my code of the logout (from another controller) It renders the page itself but the layout for that controller is not included. I've searched many solution but still, no hopes. This is a pic of how the root_path looks like when being called (redirect_to) from my dashboard controller. and this must be the design of my root_path. (Layout included). Take note that the URL is the same but the layout is not being rendered. but when i refresh the page it shows the layout. |
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