Custom Controller Method, Route, & ERB | Fixed issues |
- Custom Controller Method, Route, & ERB
- Rails 5 - how to dynamically add nested fields in the edit form?
- Faraday::ConnectionFailed after resetting my cable modem
- Unable to redirect from user edit page using devise gem
- Rails: why emails are sent before Users submit the form?
- Rails 5 starting thread from initializer gone crazy
- Getting data from many to many relation with rails 4
- Error while rendering a form in different controller
- How to enter passphrase for ssh key while deploy rails app via Capistrano?
- Finding free appointment slots from appointment table Postgresql Rails
- Having trouble in updating join model extra attributes in has_many through association - Rails
- Background image in inline CSS code doesn't show when ran in rails server
- Adding superuser to GitLab on Debian Jessie repository installation
- Updating unique constraint index after deleting records
- Rails 5 api - undefined method `user_url'
- React Native and Rails [on hold]
- Address already in use - bind(2) for "::1" port 3000 (Errno::EADDRINUSE)
- How to use jekyll on an existing blog made with rails
- Radio buttons in a form_tag that are styled with bootstrap
- AngularJS $resource save success function not getting data
- pg_search dmetaphone not working after installing contrib package
- How to disable sending default emails when a user place an order?
- Ruby on Rails sample project
- Importing namespaced files in a controller
- advance table search in rails
- Apartment Gem Ruby on rails redirect to the home page of heroku
- Integrating Paypal button with Rails
- ActiveRecord has_many where child model is greater than 0
- Rails Devise Recoverable - Not receiving forgot your password e-mail
- How to manage slightly different versions of the same application on Ruby on Rails?
Custom Controller Method, Route, & ERB Posted: 04 Dec 2016 07:52 AM PST I have a search form and I need to be able to filter based on whether or not pets are allowed, but I'm not sure how to accomplish this. I have setup a route, a controller method, and a button but none of that seems to be working. listings_controller: routes.rb: html.erb file: |
Rails 5 - how to dynamically add nested fields in the edit form? Posted: 04 Dec 2016 07:48 AM PST Already a month trying to solve the problem at first sight is not very complicated: There are 3 models - team, user and team_user (has_namy: through) In the form of edit and new team to do the ability to dynamically add members of this team. Scenario: - A user comes to the team new form - Indicates the name of the team - After name field select user (team member) - Click the Add member button - After validation of a member is added after team's name field in text field + delete button opposite - From the selector delete his (member) name (as it is already a team member) - In selite selects the next user, and click the Add member button - Press the Submit button to save the new team and team's members Difficulties: - I tried to do through the gem Cocoon, but it is impossible to make different parshaly to select the user to be added to it (SELECT) and has added members (full name - text) - If done through the <% = from_for ... remote: true%> and a separate controller or new action in the controller teams_controller, it will be two forms of nested (shape and form team team_user) with his 2nd submit button. Attachment forms, as I understand, is not gud. - Changes in the form (changing the name of the team and add / remove the team members have the count only after clicking on the save to basically submit the form team) |
Faraday::ConnectionFailed after resetting my cable modem Posted: 04 Dec 2016 07:49 AM PST I have (or had) omniauth-google-oauth2 successfully working in my rails app until this morning. My internet provider was briefly down and I also reset my cable modem. Now I get the following error after attempting to secure permission from google: And Line 880 is highlighted in the message. Any ideas? |
Unable to redirect from user edit page using devise gem Posted: 04 Dec 2016 07:30 AM PST I am using devise gem version 4.1.1 in my rails project and in my /users/edit page I want to redirect to the same page after the user changes his password instead of redirecting to the root_path. I googled around and found this link devise github wiki I did make the changes accordingly and my registrations controller is as follows and in routes.rb I added the registrations controller But still for some reason I am not able to redirect to the same page and it still redirects to root_path. Am I missing something? |
Rails: why emails are sent before Users submit the form? Posted: 04 Dec 2016 07:24 AM PST I have a "Static form" that sends pricelists to clients, I need to send an email but params[:pricelist_name] from the form is nil. I noticed that emails are sent before the view, so I was wondering how to send emails only after that users submit the form ? Cheers, Controller View Routes Output: As you can see in 'Subject: [] - [] - test' params are nil. |
Rails 5 starting thread from initializer gone crazy Posted: 04 Dec 2016 06:31 AM PST I have the following code in Then the following related methods: Basically starting a thread on server startup to perform some background tasks that are accepted by the app from users by HTTP calls. In development mode everything works fine. Running in production env with same puma server, the First it is (mildly said) non-obvious to me how a thread can die without an exception and returning false with the loop that I have above in
. Part of the app is checking the queue processor thread and reporting errors with it so showing up as dead is really breaking that logic. Any advises how to debug and resolve the issue would be appreciated. Thank you. |
Getting data from many to many relation with rails 4 Posted: 04 Dec 2016 07:07 AM PST I am developing a rails app with mysql database. Theres bunch of tables but for this task I am using only 3. Students, Courses and CoursesPerStudent. I have models for students and courses(no model for the third). The tables are already populated. The tables: students - id,name,family,address,phone,email,status,path Now the thing is i need to show for each student a list of the courses realted to him. How should i do it? Should i create model for the third table? how should i call it? and combine the two other tables in one to show specific courses? Or there some other way? Hopefully someone will help because im out of answers. |
Error while rendering a form in different controller Posted: 04 Dec 2016 05:21 AM PST I'm trying to render a form app/views/passengerrides/show.html.erb: app/views/requestforpms/_form.html.erb: apps/controller/requestforpms_controller.rb: Edit: apps/controller/passengerrides_controller.rb: end |
How to enter passphrase for ssh key while deploy rails app via Capistrano? Posted: 04 Dec 2016 05:37 AM PST I tried to deploy my app to digital ocean server following this tutorial. So i can clone my apps successfully but when deployed the production one it required me to enter passphrase but when i type it in my terminal it seems like nothing happened like this So how can i enter the passphrase in my terminal and pass this kind of security? Thanks! |
Finding free appointment slots from appointment table Postgresql Rails Posted: 04 Dec 2016 04:07 AM PST I have an app in ruby on rails that has Appointments which belong to Providers and I am looking to create a query that finds a provider's gaps in appointments Appointments are stored as a start and finish both which are datetimes . Ideally I would call Provider.free_appointment_slots(length,start,finish) where length is the length of the appointment required and start and finish are bounds of the search ie a particular week or day. I think it should be somewhat similar to these... How to return all the free periods of time from an appointment set Finding free blocks of time in mysql and php? I have an appointments table with data like: etc I would like to be able to provide a start and end time to search over and an appointment length and my query return the available appointment times.. for example If I was looking for appointments between 2016-11-12 08:30 and 2016-11-12 12:30 with an appointment length of 30min I would receive results such as: an additional great feature would be to be able to provide multiple search periods such as over different days I hope this is clear any help would be much appreciated |
Having trouble in updating join model extra attributes in has_many through association - Rails Posted: 04 Dec 2016 05:51 AM PST I am still a learner of Rails, and am making a simulation game of Google Adwords for training usage. Inside the game (I may only explain the related part of this question), I have three models, Adgroup (called KeywordAdgroup in my code), Keyword, AdgroupKeyword, and also a Game model that has a game_id in it. The relationship of the three models is a Now, I want to adopt a logic that every Keyword could only be added into single Adgroup of a particular game. So I added an extra attribute However, I found that with the similar code, I can validate the uniqueness in Create using The major problem is that, with the similar code in It will become something like But the save method did insert the game_id, which game_id is not nil when inserted using the save method. Something like The following is my code: keyword_adgroup.rb (the model of Adgroup) keyword.rb adgroup_keyword.rb(the join model) And majorly the relation would be built in the Adgroup controller. adgroups_controller.rb When choosing duplicate keyword in the same game in whatever adgroup, in "create", it will come to a rollback; in "update", it will just update the record with FYI, I am using Ruby 2.3.0, Rails 5.0.0, and using simpleform for creating and updating adgroup. I know its a little bit messy, sorry about that and thanks for reading my words. Appreciate any suggestions. Have already spent several hours to fix it but really hopeless after a lot of different methods. Thought that it was some conceptual problem that I haven't figured out. Updated Information While checking the console, in "Create" method, it will come to: In "Update" method, it will come to: |
Background image in inline CSS code doesn't show when ran in rails server Posted: 04 Dec 2016 05:47 AM PST I am editing my landing page for my web. I am currently using Rails 5 to develop my web. I have this css block here (I am using bootstrap as well): However, when I start my rails server, only the texts appear and the background image don't. Do take note that I am doing this inside a layout in my rails project folder. All assets (images, css, js, etc) are all in my assets folder. As for my images, they are all inside the images folder under assets. |
Adding superuser to GitLab on Debian Jessie repository installation Posted: 04 Dec 2016 03:36 AM PST I've installed GitLab via debian jessie-backports and it installed fine but there was no prompt to create superuser account. I tried to add it manually, but every solution on the Internet use which seems to be absent in my system. Is there any way to add superuser without relying on gitlab-rails tool? |
Updating unique constraint index after deleting records Posted: 04 Dec 2016 03:19 AM PST So I've got a postgres database full of users One of them deletes their account by mistake and wants to sign up again. But a validation error is called. Even though the record itself was deleted, the subdomain still exists in the index This feels like a bug to me. Shouldn't the index be updated in the after_destroy callback? Am I expected to manually drop and add the index each time someone removes their account? Any ideas? |
Rails 5 api - undefined method `user_url' Posted: 04 Dec 2016 05:31 AM PST I started a new project with Rails 5 in API mode. For the moment i just create the project, set the database and use the scaffold command. I try my code with postman to create a new user (POST) Request Result How can i fix that error ? routes.rb users_controller.rb |
React Native and Rails [on hold] Posted: 04 Dec 2016 02:17 AM PST I would like to write in first case a wep app. I am working since almost 2 years now with Rails and I like it very much. My views are always done by myself, which worked so far very good. Now I would like to expand my horizon. I want to differentiate frontend and backend. Why? Because my web app should me available as native app on iOS and Android too. So I thought I will use: http://edgeguides.rubyonrails.org/api_app.html as my backend. So everything responded as JSON. For building user interfaces and the web view I though React from Facebook would good. Because as soon as I decide to write an app I could use React Native for this purpose. So What do you think about this combination? Is this worth a try? |
Address already in use - bind(2) for "::1" port 3000 (Errno::EADDRINUSE) Posted: 04 Dec 2016 02:40 AM PST When I type |
How to use jekyll on an existing blog made with rails Posted: 04 Dec 2016 02:33 AM PST My situation is that I have just finished creating a blog using ruby on rails. I have been using localhost to see it display on my browser, but I want to deploy it online. I found out that rails apps can't be deployed on ghpages because it is not static. However, I searched online and read that if I used Jekyll, i could display it on ghpages. I have never used jekyll before, so my question is... How could I use/integrate jekyll to my existing rails app so that it can be deployed and hosted through github pages? Thank you! |
Radio buttons in a form_tag that are styled with bootstrap Posted: 04 Dec 2016 01:22 AM PST I have the following radio buttons that are styled with bootrstrap: How do I include this in a form_tag? |
AngularJS $resource save success function not getting data Posted: 03 Dec 2016 11:56 PM PST I am building an application with Rails 5.0.0 with my back-end (api-only mode) and AngularJS as front-end. While testing on my localhost API in POSTMAN, I hit the POST endpoint - http://localhost:3000/sessions.json?session[email]=shahravi@gmail.com&session[password]=foobar and receive - with status 200 from rails server - "Completed 200 OK in 120ms" I am using Active Model Serializer to get this response back through - inside my rails controller. However, inside my front-end angular code, when I hit the same endpoint, the $resource $save function does not execute the success callback. It gets the following data back from the endpoint in the error callback - My angular code is written as - where LoginResource is defined as - Can somebody help figure out where the problem is? Why does rails server return success with right data, but angular does not get success code or the data? |
pg_search dmetaphone not working after installing contrib package Posted: 03 Dec 2016 11:41 PM PST After installing pq_search and running contrib package migration: It still throws error when migrating the dmetaphone migration: |
How to disable sending default emails when a user place an order? Posted: 03 Dec 2016 11:46 PM PST I am working on a Third party application where I want to send customized template emails to user using webhooks when user place order or shipment gets created. Is it possible to prohibit system to send email to user who place order and instead of that just fire an event to a third party app(using a webhook) so that that third party app will send email to that user with required and customized new details in new email template(which is not available in default variables of email templates)? Any solution for this? Please |
Posted: 03 Dec 2016 11:19 PM PST I'm looking for a sample project online which I can follow to create my startup project. I'm fairly new to RoR and created some simple projects. Here is what I'm looking for: Admin side: -Create, edit, and delete user account -Post new payable/amount to particular user (e.g. billing) User side: -Login and change password (with the use of Devise gem) -Manage payments, can pay new posted payabale (Stripe or Paypal) -View payment history They system will send email notification to user for new payable, as well as when they submit the payment. There should be two tables, users and payables (one-to-many), users can have more than one payable. Please let me know where can I find a sample project. Thanks. |
Importing namespaced files in a controller Posted: 03 Dec 2016 10:59 PM PST I have the following files: /lib/stripe/stripe_invoice.rb Now in my controller I am trying to use it: I get an error for uninitialized constant StripInvoice. If I add: I get the error: What is the correct way to import my class file so I can use it in my controller? Also, how can I create a namespace for my class StripeInvoice and how would that change the way I import it? |
Posted: 04 Dec 2016 12:54 AM PST In my app i have generated a scaffold called data and had filed the table with name, school, college, views, interest. Now i want to add a search that if someone put NAME in the search bar, they should get all the names only as results, if someone had put college, they should get all the college only. Am pretty new to rails, so i tried watching some tutorials, and had added this but this is not what i want in controller This had added a search but not the type of search i had mentioned above. |
Apartment Gem Ruby on rails redirect to the home page of heroku Posted: 03 Dec 2016 06:27 PM PST I'm using the Apartment gem in ruby on rails to work with multitenancy and in local host works fantastic, but I did deploy to heroku and I get redirect to the main page of heroku I have my own domain but when I visit my domain just says: This website is temporarily unavailable, please try again later. so I dont know what to do, I need to use amazon ? you know some configuration guys ? Regards ! and thanks for your time ! |
Integrating Paypal button with Rails Posted: 03 Dec 2016 05:53 PM PST I am trying to integrate Paypal in my rails application by generating a hosted button from paypal. I am following the following guide https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/buy_now_step_1/ but I cannot find a way to dynamically generate a buy now button with custom prices and description without first creating it through paypal.com. My question is is there a way to generate the buttons dynamically from my database of items so that they don't have to be first created through paypal.com manually. or Is there a better way to do this? I'm new to both rails and paypal API. |
ActiveRecord has_many where child model is greater than 0 Posted: 04 Dec 2016 01:46 AM PST I'm trying to solve a seemingly simple AR problem I'm having. I can't figure out how to return a list of events that have 1 or more attendees, and the docs examples use I have a simple event model with a and an attendees model that belongs to event But some events will have 0 attendees. So what's the ActiveRecord way of doing this without using It seems like it would be something like:
but I keep getting a column error. |
Rails Devise Recoverable - Not receiving forgot your password e-mail Posted: 03 Dec 2016 04:11 PM PST production.rb devise.rb application.yml heroku logs I registered my env variables on heroku and double checked they were correct in the dashboard. No clue why I am not receiving the e-mails. Heroku logs isn't pointing me anywhere to why its not working. Anyone have any ideas whats wrong with my code? Thank you!!! |
How to manage slightly different versions of the same application on Ruby on Rails? Posted: 03 Dec 2016 10:22 PM PST I have a Rails 4.2 application that is tailor-made for a specific industry and now I have to upload the same app, but for a new client from a different industry. Given this, I need to do some slightly changes in the database and code (90% of the code should remain the same). What is the best approach to have different versions of the same app? Should I use Rails plugins? I don't want to have two completely separate application because I will be doing maintenance twice almost all the time and having one big app will make it too complicated (and also I need two different database structures) Please let me know what is the best option. Thanks! |
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 |
Custom Controller Method, Route, And Erb >>>>> Download Now
ReplyDelete>>>>> Download Full
Custom Controller Method, Route, And Erb >>>>> Download LINK
>>>>> Download Now
Custom Controller Method, Route, And Erb >>>>> Download Full
>>>>> Download LINK