Rails: Prevent id conflict with a method | Fixed issues |
- Rails: Prevent id conflict with a method
- Failure in Chapter 9 of Rails Tutorial:
- Mongoid paperclip ActionController::RoutingError (No route matches [GET]
- rails pass array link_to
- Railstutorial By michael hartl (3rd ed.) chp.10 ex 2 - Show users only when activated
- Digital ocean droplet running rails application getting compromised
- Stripe: received unknown parameter: fingerprint
- Remove object from array without deleting it from database
- How to make Act_as_votable to work with json
- Undefined method in controller
- unx_ext 0.0.7.1 ruby 2.3.0 problems
- Cannot reset db with MyModel::MY_CONSTANT in routes.rb
- Rails get data from child table in rails
- Include Gem Not Working
- How do I setup a reject_if on a nested, nested resource in Rails 4?
- Rails - Register a user in stages. Starting with username
- How to get dynamic select_tag params in controller
- How to limit someone to deleting their own comment in Rails?
- Rails update array by second array
- How to use lemmatizer_base and lemmatize_ru with thinking sphinx?
- TimeStamps in Mongoid Embedded Documents
- getting No message given error in my Rails test
- How to customize fields_for
- SIT in rails not working for audited-activerecord
- How to use httparty to send a post request to devise_token_auth
- Sitemap file not found on production
- Rails using fire-base
- Error in OR condition in include query of Rails 4
- Rails: Skip logging backtrace
- Rails image_tag full path
Rails: Prevent id conflict with a method Posted: 28 Mar 2016 06:59 AM PDT I am using string as id in routes (e.g. resource/:id ) but id can also be 'new' (a method in my Controller) which rather than showing the resource with id=new, directs to create new resource. How can I restrict users from choosing id=new while creating new resource? |
Failure in Chapter 9 of Rails Tutorial: Posted: 28 Mar 2016 07:00 AM PDT After running the test suite, I get the resulting failure: I have been trying to work this out for a few hours now and am pulling my hair out. This is the file: users_index_test.rb: |
Mongoid paperclip ActionController::RoutingError (No route matches [GET] Posted: 28 Mar 2016 06:44 AM PDT I have a view where I can create, edit an Room and I can chose a photo for that room when I chose the photo and click the update button I get an error that says: Here class model : Here Route Anybody help me please, whats' wrong my source code :-( ...?? |
Posted: 28 Mar 2016 06:40 AM PDT I have a link want to send array of params to contoller but have received Unpermitted parameter but i have it So my question is how to correctly send array of params? |
Railstutorial By michael hartl (3rd ed.) chp.10 ex 2 - Show users only when activated Posted: 28 Mar 2016 06:40 AM PDT I am working on the railstutorial by michael hartl (3rd edition) exercise 2 There are two small parts in this exercise. First one is a rather easy one (needed to change a FILL IN with TRUE), also the second one should be rather easy, but I am getting an error: Explanation: A user wants to access an other user's profile page. When this account is not yet activated the user that wanted to access, gets redirected to the root page (easy right?)The code that I know should do this job: (small note: originally the book uses @user = User.find(), I have changed this to User.find_by_id(), because there was an error raised when navigating to an unactivated users page, There are 3 other controller files where I have used the "activated?" method, without any errors whatsoever. But in this occassion I get: undefined method `activated?' for nil:NilClass when visiting an unactivated user's page Console: Its weird because this is the correct usage. It's shown so in the source code on the github of michael hartl, and I have seen this in other questions regarding this exercise (no duplicate here, the ones I found where about integration tests) So my question here. What causes the undefined method error when in other controller files I can just use the method, and what is the fix to redirect the user properly, because as far as I know this is the right solution? Otherwise I really would like to know the answer, thanks in advance!! |
Digital ocean droplet running rails application getting compromised Posted: 28 Mar 2016 06:29 AM PDT I was running my rails application on a digital ocean droplet with Ubuntu 14.04. Within days of launch, my droplet got hacked. I had taken care of the following things while setting up the droplet. But still the security had been compromised. 1) No root password. I had set up the root user with ssh key 2) The rails application is hosted in a private repo. So not even the IP of the machine was exposed. 3) Changed the default port of rails app. I know the above configurations are basic but it usually gets the job done for me. I setup a new droplet after the droplet was compromised. Again, within days, the new droplet was also compromised. So there is definitely a security hole in my setup. To give a background about the rails application, it is an app that uses Twilio voice APIs , MySQL as the DB, unicorn as the app server, sidekiq and redis for background processing. I still have console access to the latest compromised droplet. While looking for clues in the compromised droplet and noticed some rogue ssh key entries in authorized_keys file. I could not find anything else out of the ordinary or how the authorized_keys file got new entries. How should I be debugging this problem ? |
Stripe: received unknown parameter: fingerprint Posted: 28 Mar 2016 06:55 AM PDT In my tests I received error: This is my code: What I am doing wrong? |
Remove object from array without deleting it from database Posted: 28 Mar 2016 06:43 AM PDT I'm having an issue where I just need to remove the duplicates from 2 array of active record objects. The only thing is it is removing it from the database only and I just need it removed from the array in this case. I followed this Remove object from an array of objects and also tried a few other things and they were able to remove it from memory and explicitly remove it from array and not the database but I'm not able to replicate it. Any suggestions would be great. Thanks all! |
How to make Act_as_votable to work with json Posted: 28 Mar 2016 06:24 AM PDT i am using act_as_votable in my micropost conrtoller like this and in my micropost view i have it like this so when ever i vote i get this error in console app/controllers/microposts_controller.rb:35:in but after refreshing the results appers. how can i fix it for results to change without refreshing it |
Undefined method in controller Posted: 28 Mar 2016 06:38 AM PDT I'm getting an error when trying to call a method in my controller. Following tutorials on how to get this to work but just a bit stuck in the mud and need some help. My model My controller I'm guessing it's something fairly simple I'm forgetting. |
unx_ext 0.0.7.1 ruby 2.3.0 problems Posted: 28 Mar 2016 06:28 AM PDT I've got some problem with unf_ext 0.0.7.1(and more) gem. The gem is dependency to gem domain_name. The problem occured when I would like to upgrade my application form ruby 2.1.5 to 2.3.0. My system is OSX ElCaptain with zsh console. The same error is when I try to install this by the hand. I try also to use CC=clang, upgrade gcc to 5.3.0. Thank you for reply |
Cannot reset db with MyModel::MY_CONSTANT in routes.rb Posted: 28 Mar 2016 06:00 AM PDT In my routing I have the following rule Appearantly Postgres cannot run the migrations when I reference the model in routes before it has been created. How do I work around this? Ideally I'd like to have the constant defined in the model. But perhaps I'm forced to define it in a module, so that Rails don't complain? |
Rails get data from child table in rails Posted: 28 Mar 2016 06:36 AM PDT I have three tables like
users structure companies posts I need view post from posts table which is created by user having I don't know how much did it mean, because I'm newbie on ruby on rails. |
Posted: 28 Mar 2016 05:51 AM PDT I'm getting a weird error when I'm trying to include a gem within my controller, below is the code i'm using in the controller and the error I get is: The code returning this error is as follows: Not too sure why this error is returning? |
How do I setup a reject_if on a nested, nested resource in Rails 4? Posted: 28 Mar 2016 05:05 AM PDT I'm getting the following error when submitting my form on my I've tried setting up a report.rb workout.rb measurable.rb And finally here's my report_controller.rb The thing I'm guessing might be the issue is how I have my strong parameters set up. I've not really done something this way before but, it seems that might be an incorrect way of doing things. |
Rails - Register a user in stages. Starting with username Posted: 28 Mar 2016 05:00 AM PDT I want to change my user registration. Instead of letting the users fill in all the details at once I would like the user to fill in only the username and bring him to the registration page with the username filled in and he has to add the rest of the details. What I have now at my landingpage (basically copy of the new user page): My registration page is at registation_path I would like the user to fill in the name in 1 form at the landing page and get redirected to the registration form with the name filled in. |
How to get dynamic select_tag params in controller Posted: 28 Mar 2016 04:52 AM PDT Now how I get the selected value in controller. Meanz they are dynamic then how I get |
How to limit someone to deleting their own comment in Rails? Posted: 28 Mar 2016 05:48 AM PDT I am very new to Rails. I completed a tutorial here that walks you through the steps of creating a blog using it. Part of the tutorial shows you how to create a controller that allows users to add comments to an article. I am trying to modify it so that users can only delete their own comments (and not others' comments). Question: I feel like the right way to go is to mark the user some way when they submit the comment. Save that information in the database, and then check that information when someone goes to delete a comment. But I can't think of a way to do that without trying to build a full on log in system for users. Code: Database Migration: Controller: Template: Delete Comment: I found a similar question here, but there wasn't an answer that worked. |
Rails update array by second array Posted: 28 Mar 2016 04:40 AM PDT I want update collection of records by array I have product image and product its array of and images its array of so i have tried update all product through image array but no luck How to do it? |
How to use lemmatizer_base and lemmatize_ru with thinking sphinx? Posted: 28 Mar 2016 04:35 AM PDT How to set options: lemmatizer_base with path to dictionary and morphology: lemmatize_ru in thinking_sphinx.yml in rails application (thinking sphinx gem) ? |
TimeStamps in Mongoid Embedded Documents Posted: 28 Mar 2016 05:26 AM PDT I am having a collection A which embeds collection B. Collection A as well as collection B includes Mongoid Timestamps (created_at and updated_at). Now when I create a new entry of collection B (embedded object) using Rails admin, time stamps saved in Database are nil. But if I create a entry from rails console or from a normal api, then timestamps saved in database are not nil. Any help would be appreciated. EDIT: Class B is embedded in class A. When a entry of B is created inside A through rails admin, then created_at and updated_at fields of B are getting saved as nil. |
getting No message given error in my Rails test Posted: 28 Mar 2016 04:31 AM PDT there are two models user and resident .. and both has one to one relationship (has_one) btw them. this is the test for the user(user-test.rb) I m getting error in this test : After executing the test,error came is as follows : the link for user model is as follows : Pls help me passing this test,I m trying since 30 minutes ! |
Posted: 28 Mar 2016 04:50 AM PDT I'm a rails newbie, today I got a problem with fields_for. Hope anyone can help me. I have a model project: and a model task: but when I made a form_for project: ... it render all the existing task of the project in db. plz help me! |
SIT in rails not working for audited-activerecord Posted: 28 Mar 2016 04:34 AM PDT I am not able to retrieve I have: when I make Please let me know ASAP. |
How to use httparty to send a post request to devise_token_auth Posted: 28 Mar 2016 04:02 AM PDT I am new to rails and apis. I wanted to build an api for authentication for a rails app and installed the devise_token_auth gem. I have nothing other than this gem and it is brand new app. When I try to use HTTParty to send a post request I am getting the error The documentation says Email registration. Requires email, password, and password_confirmation params. A verification email will be sent to the email address provided. Accepted params can be customized using the devise_parameter_sanitizer system. My httprequest: What should my post look like to make this working? Thanks, Megha |
Sitemap file not found on production Posted: 28 Mar 2016 04:08 AM PDT I am using the sitemap_generator gem and have the following configuration at config/sitemap.rb:
The app is hosted on heroku. When I do a Now I try to find the sitemap.xml.gz file and its nowhere on heroku. I do a In the past I had these two lines on sitemap.rb as well: but still the sitemaps were not generated on this folders. Any clue what I am doing wrong and is not generated? |
Posted: 28 Mar 2016 03:32 AM PDT I have problem during using fire-base with rails to making a real time form in rails with fire-base how it will be done .. please help me i am new in fire-base. How to make a real time sharing form in Rails using fire-base. sorry for bad English ;) |
Error in OR condition in include query of Rails 4 Posted: 28 Mar 2016 04:56 AM PDT I am using Where When i run code then got below error: Where is actual issue did not found. Any one have a idea on it. Thanks |
Posted: 28 Mar 2016 03:21 AM PDT I am logging the errors of a rails application using exception_logger (https://github.com/ryancheung/exception_logger) and it is working file. But it is logging the backtrace which I don't want to be logged. Is there any way to stop logging backtrace? |
Posted: 28 Mar 2016 03:42 AM PDT I have images in my assets folder and path to it so i want to use it like
Is it possible if so how to fix it? |
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