All Questions
Tagged with controller ruby
29 questions
1
vote
1
answer
129
views
Rails controller to handle offers and payments for rental housing
I've been adding stuff a bit "blindly" to my controller and currently everything is working as it should, but the controller is gotten very messy. I'm using the gem ...
2
votes
1
answer
103
views
Rails thin controller method to change account plan and fire slack message via a service object
I'm a beginner with Rails and am trying to figure out how to keep my controllers clean and thin, and how to work with service objects. I am building an internal tool to manage our SaaS customers, and ...
3
votes
2
answers
200
views
Rails controller for a vocabulary quiz
I'm new to refactoring and I have just refactored an old Rails project that had bloated controller methods.
I spun off the bloated methods into its own separate controller following this logic, since ...
3
votes
2
answers
72
views
Saves files and attachments regardless of errors in the model
I have a long form with dozens of fields, and users can upload photos and attachments in the form. It's super annoying when there is a simple field missing, the record doesn't save, and the user has ...
3
votes
1
answer
210
views
Rails 5 controller to get information about Steam users
I've done a bit of modifications and finally got it working, and did a lot of reading about @ vs @@ vs just declaring and I came ...
3
votes
1
answer
90
views
List enrolled users & show checkmark if all activities are complete
I'm a beginner with rails working on a rails 4 project to use with my students. Users enroll in lessons; on enrollment, four activities are created for each user (expositions, scrambled, dictations, ...
1
vote
1
answer
2k
views
Rails Grape API Endpoint optional params validation in update
I have the following rails grape api endpoint in the users resource:
...
3
votes
1
answer
74
views
Extracting queries from controller to model
I had a complex query in the controller like:
...
2
votes
1
answer
82
views
Redirecting to the appropriate URL for some type of notification
I have a polymorphic notification model with action attribute. When user clicks on a notification he/she should be redirected to given page the notification refers to through notifiable.
What is the ...
5
votes
2
answers
149
views
Rails controller to manage EC2 instances
I did a small sample application for an Interview. Since I didn't got accepted I would like your opinion on how to improve it.
The aux methods are private.
I have a ...
2
votes
1
answer
611
views
Polymorphic event notification model in Rails
I have a polymorphic notification model. When user gets a notification he can get on the page of the notifiable to check out what happened exactly. For instance ...
2
votes
1
answer
372
views
Conversational bot architecture
I am currently building a small conversational bot, and I am struggling with the architecture. I use Facebook Messenger combined with Wit.ai's API and a Shopify store API. My rails app is the ...
1
vote
2
answers
124
views
Controller method to manage SMS subscriptions
I have a huge method in my controller that is not DRY and just could use some general TLC. I'm new to ruby and I have not refactored my own code before, only contrived code you find on tutorials. ...
1
vote
1
answer
69
views
Updating an auto-generated invoice (future) when current plan changes
I've built-out a mechanism to go and find an auto-generated invoice and update it with new information when a plan is changed or if users are added to the plan for the current billing period. It will ...
3
votes
0
answers
83
views
Fat Controller Action - Deep nested filters
I have this really really long controller action and would like someone to help me break it down.
...