Why put the business logic from controller to the model? [on hold] | Fixed issues |
- Why put the business logic from controller to the model? [on hold]
- Ruby on Rails - undefined method `errors' for nil:NilClass
- Rails mailman, receiving and saving emails with embedded images ?
- OAuth facebook with rails
- Rails - CKEditor with Carrierwave
- Data not retrieved from Google Drive with the service account (Ruby on Rails)
- Rails 5 ActionCable on Heroku uninitialized constant NameError
- Ruby on Rails - Devise - Cannot save user with many-to-many associations
- Updating city state list in rails app
- rails heroku "production.rb" file
- error: failed to push some refs to 'https://git.heroku.com/radiant-chamber-18560.git'
- Fragment caching for each session id separetely, Rails 4 + Ransack
- Uploading/playing mp3 files using Rails
- Where is the Redmine plugin generator? How to create a new plugin?
- Heroku Everything Up-To-Date
- How to send mails automatically using whenever gem
- Ruby on Rails 4: Where i have to put Common code?
- rails excel generation - alignment of column text
- How to reduce external API calls in rails
- Scrapping data in rails using thread
- How to view excel sheets in rails4 without downloading/using googledoc/microsoft office docs
- Fetch Game with time of EST Timezone
- Having trouble using where.not in rails
- Rails+Devise: No error message is shown
- Ruby on Rails installation on Windows via Proxy
- Why the "post request" defined to "button_to" as default turns to "get request" only after we restart the rails server?
- How to keep attributes from two different tables synchronized in RoR?
- Keeping track of state of model data
- In Rails Console, Is there a way to disable or shorten the error path list?
- Can't persist array in a Postgres column using Active Record
Why put the business logic from controller to the model? [on hold] Posted: 22 Oct 2016 07:12 AM PDT For rails development, I was told that it is better to move logic from controller to model, anyone could point me the reason about this? |
Ruby on Rails - undefined method `errors' for nil:NilClass Posted: 22 Oct 2016 05:38 AM PDT This questions seems duplicate but I have checked all other related questions and none of the answers apply as I have tried them all. I am trying to create a user signup form. My user model (user.rb) is like this. The user controller (users_controller.rb) is like this And the users new view (new.html.erb) is like this. The routes (routes.rb) are like this And rake route gives me following output. Yet when I try to access http://localhost/users/new from my browser, I get the following error. |
Rails mailman, receiving and saving emails with embedded images ? Posted: 22 Oct 2016 04:50 AM PDT Is it possible, using mailman gem, to receive and save e-mails with embedded images? Currently I can save body's html_part to Emails table using |
Posted: 22 Oct 2016 04:23 AM PDT I have a rails application, I want to add them to authenticate via Facebook, in its application to authenticate I use devise, I read the documentation to devise and how to add to it Oauth now I have this code omniauth_callbacks_controller.rb routes.rb devise.rb omniauth.rb and have facebook enter image description here enter image description here please help me, what am I doing wrong |
Rails - CKEditor with Carrierwave Posted: 22 Oct 2016 04:02 AM PDT My model with images: My uploader: I can add a post with an image inside it. It is displayed properly. I can also delete a post, but what I noticed is that the files from Two questions:
|
Data not retrieved from Google Drive with the service account (Ruby on Rails) Posted: 22 Oct 2016 04:01 AM PDT Hi I created the google service account with the email A@gmail.com. I downloaded secret json file and put into the working directory. Then initialize and authorize api with this type of commands. It works at this stage with the out of
Then, I ran the below command as Google api document explains. The only file that is retrieved is "Getting Started" file even if I recalled with page_size 10. Inside of google drive whose email account is A@gmail.com, I created a couple of files ( google document, google spread sheet , etc) but none of them are retrieved with the command above. Is that because of the service account? For instance, my service account email(client_email) is brbrbrbr...@appspot.gserviceaccount.com, which is apparently different from A@gmail.com. Please give me any idea on this issue! Best |
Rails 5 ActionCable on Heroku uninitialized constant NameError Posted: 22 Oct 2016 03:49 AM PDT I'm aware of the fact that Heroku only allows 2 ports, i.e. 80 and 443 for connection, which is why you need to run a separate server for WebSockets. I came across this guide which claims to allow you to run both processes on the same server. I also changed the line: My application.rb file looks like this: TIA. |
Ruby on Rails - Devise - Cannot save user with many-to-many associations Posted: 22 Oct 2016 04:45 AM PDT I am trying to create a new User with multiple Roles using Ruby on Rails 5.0 and Devise 4.0. I am using a form and this is what my This is what my controller looks like: The line with
More info: More digging and I found out that, indeed, my middle table is invalid because it has a Hope to have been clear enough as to what the problem is. I think that I am doing the wrong things in the controller but I don't know how to do better.. and ideally I would still wanna call UPDATE My User model: My Role model: My schema: |
Updating city state list in rails app Posted: 22 Oct 2016 03:20 AM PDT I m using city state gem in my rails app However I do realize that the list of cities or states of most countries outside of the US isn't complete. How do I add or update these list to complete what I want. Can I also even correct some naming of cities that are wrong From a code like this: I get a list of cities and provinces all together. some are even missing and i would like to correct that. Any suggestion |
rails heroku "production.rb" file Posted: 22 Oct 2016 02:49 AM PDT When I change "config.assets.compile" to true in "production.rb" my images show on heroku. But when I set it to false they won't show. I was under the impression that you either set it to true and don't "rake assets:precompile", or you set it to false and do "rake assets:precompile". But it seems the images only show when i set it to true. What's going on here? |
error: failed to push some refs to 'https://git.heroku.com/radiant-chamber-18560.git' Posted: 22 Oct 2016 05:59 AM PDT I run these commands
Then.
What should I do? |
Fragment caching for each session id separetely, Rails 4 + Ransack Posted: 22 Oct 2016 01:00 AM PDT I want to cache search block for each user/visitor separately so when user/visitor has searched or sorted for anything search block is cached with all CSS and visual changes. So when user revisits Advertisement#index page in 5.minutes Rails cache renders the same search block as he left. Previously, I tried to count clicks on sort links and then save them as cookies and then when Advertisement#index page is loaded, make all clicks. But that approach was very nasty and didn't work sometimes. So far I have successfully cached search results and retrieving them based on session.id. My code in Advertisement_controller:index : This code generates this cache: q_925feaae9c1cd1f6948899e672838c0a. My search block: Problem: Rails wont cache search block when search occurs, but when I first time visit Advertisement#index page. How could edit my code so search block cache is renewed each time search occurs and serve this cached search block for 5.minutes or new search ? I have searched for similair questions, but none was like mine. Thanks for any help. |
Uploading/playing mp3 files using Rails Posted: 22 Oct 2016 03:47 AM PDT I'm working on my first "real" Rails project - "modernizing" an old website for a church choir and am building it in Rails. They currently have a practice page with a list of links to mp3 files stored on their server. I would like to store the mp3 files in a database and have created a model for the songs - title:string, part:string (tenor, soprano, etc), audio:binary (this is the mp3 file). When I submit the form, the audio field is nil - the other fields save correctly. Should I be using a Gem for uploading/saving the mp3 files? I've come across CarrierWave, but have only seen it used with images. I was under the impression that the binary field in active record was for preserving the original file format. Thanks in advance! |
Where is the Redmine plugin generator? How to create a new plugin? Posted: 22 Oct 2016 12:39 AM PDT I am newbie to redmine want to create redmine plugin . Whether I need to create new project and then execute steps listed here ? http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial Or any other good document that I can follow . |
Posted: 22 Oct 2016 06:00 AM PDT So i've googled this error messages and went through the various stack overflow posts with regards to this. My issue came yesterday when the Dyn DNS were under a DDoS attack. Anyway the initial problem was that when i tried doing I tried everything i found in the various relevant stack overflow posts. From doing After trying various other things i gave up and decided to simply delete my heroku app and try pushing all over. Now the weird thing (which may just be my lack of understanding of how all these works) would be even after deleting my app and not creating a new one, when i run the command Additionally i have also tried I can't seem to find any updated documentation on this issue as well so i'm hoping that someone can point me in the right direction or steps to take. |
How to send mails automatically using whenever gem Posted: 22 Oct 2016 01:13 AM PDT I used when ever gem to send mails every day but it's not sending.I am using schedule.rb: Listings.rb:(model-file) In production: After running these commands I am getting responses like this
Please provide solution to this. |
Ruby on Rails 4: Where i have to put Common code? Posted: 22 Oct 2016 04:39 AM PDT I am new to Ruby on rails. i am using rails 4.1.6 and what i want is to make log of all the process in one text file is there any global location that we can use in active admin like component in cakephp. thanks EDIT
|
rails excel generation - alignment of column text Posted: 21 Oct 2016 11:45 PM PDT I export a excel through rails app using gem "axlsx_rails" and 'acts_as_xlsx'. Here my doubt is why the numbers are aligned as right alignment and alphabets are aligned as left alignment in spreadsheet columns. |
How to reduce external API calls in rails Posted: 21 Oct 2016 10:48 PM PDT I have integrated facebook, twitter API's in my rails application for getting hashtag records. Everything is working fine but API calls are taking too long too execute which is really very frustrating. I googled around to get rid of this. There are curl_multi functions available in PHP. Is there something available in rails too? |
Scrapping data in rails using thread Posted: 21 Oct 2016 11:21 PM PDT I am doing scraping to fetch the data from the website to my database in rails.I am fetching the 32000 record with this script there isn't any issue but i want to fetch the data faster so i apply the thread in my rake task but then there is a issue while running the rake task some of the data is fetching then the rake task getting aborted. I am not aware of what to do task if any help can be done i am really grateful . Here is my rake task code for the scraping. end Error i am receiving: ActiveRecord::ConnectionTimeoutError: could not obtain a connection from the pool within 5.000 seconds (waited 5.001 seconds); all pooled connections were in use |
How to view excel sheets in rails4 without downloading/using googledoc/microsoft office docs Posted: 22 Oct 2016 03:22 AM PDT In my rails-4 application, I need to show the excel(xls,xlsx) file contents without using external services. The external services will be available if the documents are public. Without downloading I need to open the excel attachments. Is there any way to do this in rails. Please help. Thanks in advance. |
Fetch Game with time of EST Timezone Posted: 22 Oct 2016 12:33 AM PDT I have Game table, from which I want to fetch game which started in time between 11:00:00 to 14:00:00. But my start_in_time stored in database is in UTC. And I want to fetch games started time 11:00:00 EST and 14:00:00 EST. I have used mysql as database above query but in database I am getting syntax error. How to make this correct ? |
Having trouble using where.not in rails Posted: 21 Oct 2016 09:35 PM PDT I am trying to use where.not to replace the following: With However I am getting the following errors. |
Rails+Devise: No error message is shown Posted: 21 Oct 2016 09:46 PM PDT |
Ruby on Rails installation on Windows via Proxy Posted: 21 Oct 2016 08:39 PM PDT i try but can do this ... how to set proxy , really i don't know also see stack overflow and other forums... here links: Issue installing gems on windows 7 with proxy but can not get it how to set variable , which proxy give(ip..browser or other) and how set port , plz can anyone simple way explain how to solve... Thanks in advance...!!! ERROR: While executing gem ... (URI::InvalidURIError) bad URI(is not URI?): http://http_proxy = username:password@proxyserver:port |
Posted: 21 Oct 2016 08:25 PM PDT || Ruby 2.2.4 || Rails 5.0 || Bootstrap-sass 3.3.7 || Devise 4.2 || I am one of many programming learners having problems with the button_to in ruby on rails and the solution is add the method ":get", but what most of us don't know is about the obligate server restart! At least with functions like destroy and edit, this is the only way to fix the button_to issue ! I would like to understand why the server have to be restarted? |
How to keep attributes from two different tables synchronized in RoR? Posted: 21 Oct 2016 10:27 PM PDT What I want is to be able to easily be able to find the team name associated with a membership without having to send another request to the database. My plan was to just add a team_name attribute to the Memberships table, but I can't think of a way to have this new attribute stay in sync with the name attribute in the Teams table. In other words, I want it to be the case that, if the owner of a team changes the team's name, then all memberships to that team will be updated (with the new team name) as well. Here is what my setup looks like. I've fairly new to Rails. /app/models/membership.rb /app/models/team.rb /app/db/schema.rb If there is a better way to achieve what I am asking, then please let me know as well. |
Keeping track of state of model data Posted: 21 Oct 2016 07:26 PM PDT I want to track positions and portfolio value over time in my portfolio in order to present them on a graph. My portfolio has many positions. Positions store stock price and quantity. Each position has many movements that either buy or sell quantities of shares of stock. The problem is my application updates the price every day to reflect current market prices. And I can also change the quantity to remove or add quantity of shares. I calculate portfolio value by taking the total of stock price x quantity for each position. I want to be able to do two things 1) Store values of portfolios over time and plot them on a graph 1) Store values of positions over time and plot them on a graph I am thinking of creating a chart-object model that will simply take a snapshot/store the positions and portfolio values at the end of each business day and I can then use that model to populate a graph. Is this the best design decision or is there a more efficient way to store/ track the data through states? |
In Rails Console, Is there a way to disable or shorten the error path list? Posted: 21 Oct 2016 08:14 PM PDT |
Can't persist array in a Postgres column using Active Record Posted: 21 Oct 2016 05:20 PM PDT I know this question may sound duplicated, but none of the solutions I've found actually solved my problem. I have a model named pet with photos column, here's my schema: I'm not using the serialize method in my class because a lot of other sources confirmed that it's not necessary. Here's my object: No matter I do, I cannot persist a new photo array: I've already tried several ways of persisting, like: or even (like this guy suggested, and this other guy as well): and none of them seems to work. Using Postgres command line I was able to save and update and array with no problems, but this issue seems to be related to active record. activerecord (5.0.0.1) postgres (9.6.0.0) Thanks a lot :-) |
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