ruby on rails: exporting DB from development to production | Fixed issues |
- ruby on rails: exporting DB from development to production
- Uncaught Error: Unknown provider: $controllerProvider from Students
- Why Rails defaults creation to a POST on collection in HTML form?
- Complexe authorization system
- Rails keeps putting text onto my page within {} and [], how do i get rid of this?
- Rails tutorial: delete method doesn't work
- How do I check if an element exists inside a jQuery plugin?
- Pushing Rails app to Heroku seeing no difference on asset files
- URL slugs for nested resources
- Storing and Retrieving postgres nested JSONB data type in rails form
- Method returns an Array object
- Delaying Mail with ActiveJobs won Rails 4.2
- Image galleries in Rails
- rails will_paginate with different partials
- Override Spree 3 Registration Controller
- Can't install gem nokogiri with 2.3.0p ruby
- how to make this code drier
- Create an excel in delayed job method using axlsx
- Oauth2 access to API by email/password
- How to have javascript files included only on certain pages
- In Rails app, jQuery click handler stops working after clicking link to go back
- Incrementing dynamic variables in Rails models
- How to run capistrano tasks over lossy connection?
- Why Rails 5 uses ApplicationRecord instead of ActiveRecord::Base?
- uninitialized constant EventController::TempFile
- Setting up a rake task with Resque Scheduler - Rails 4
- Nested throttle for API in rails
- Rails: Bundle install not working
- How to get time x days ago from a specific date in Rails?
- Rails - establish_connection and nested forms
ruby on rails: exporting DB from development to production Posted: 21 May 2016 06:33 AM PDT Hi I'm using the gem yaml_db to export my development database from postgres to production, which is on a virtual machine where my ruby on rails app is. So im using anyone knows how to solve this? Or is there other method to export my database? |
Uncaught Error: Unknown provider: $controllerProvider from Students Posted: 21 May 2016 06:33 AM PDT I am using angular js in my rails application. When I land on my page, it works well but when I navigate in the app and come back on the same page, everything collapses. Upon 'inspect element' i found this error: I used all solutions available on stack overflow but problem is still there. kindly help. here is my code. If you need to know something else, please let me know. javascript, which i have written right below this html any help will be highly appreciated. |
Why Rails defaults creation to a POST on collection in HTML form? Posted: 21 May 2016 06:15 AM PDT When generating a scaffold, by default the This makes total sense in a RESTful mentality. But, given that the generated material does not uses it as a REST resource, why does it POST to the collection path? When the resource is successfully created, Rails will redirect to the created resource path. When any error occurs, Rails will render the This seems fine, except that when any errors occurs when trying to create the resource, the URL will change to the collection path. This means that if user tries to refresh the page, it will not see the creation form. If the application does not allow listing for this resource, a routing error may happen. In case the application uses any type of authorization and the current user does not has the required authorization to list stuff, it may see a forbidden. I see Rails scaffold generator as something the community agrees to be the standard way to do basic CRUD in it. So, why this behavior? It seems that by keeping a purist RESTful resources approach we are breaking user experience a bit. To see an example of this, just create a new Rails application, scaffold a new entity and try to create it with some validation errors. If you think "this should not harm a real application". I've come up with this when writing tests for authentication. My application is using Devise and fails for this test: What this means in real life: When user tries to create an account, submit an invalid form, see the error and hit refresh, it is on an invalid path as the resource does not support listing (i.e. To make that last assertion pass, I had to overwrite the default Devise view to submit the form to My bet is that I'm missing something, but I can't figure it out. So, what am I missing? |
Posted: 21 May 2016 06:06 AM PDT I've to develop a complexe authorization system for a JSON API, but I don't know how to proceed. The possible permissions have to be dynamic. I'll have a dashboard to allow / disallow access to resource. I've a This can be sum up with the following model: The Here's my problem: If someone access the URL
I first came with the idea to give a In my controller, I can have: Do you know if there any pattern / gem that can help me create that kind of system ? |
Rails keeps putting text onto my page within {} and [], how do i get rid of this? Posted: 21 May 2016 06:44 AM PDT This is an example of the outputted text, when inspected using dev tools, it's listed under text [#] |
Rails tutorial: delete method doesn't work Posted: 21 May 2016 05:34 AM PDT I'm following instructions of this tutorial: http://guides.rubyonrails.org/getting_started.html I have a problem with deleting articles. I've written the code as the tutorial suggests, and link 'Destroy' has appeared, but when I click it, instead of asking me for a confirmation and deleting the article, it shows me the article's page, i.e. it does exactly the same thing as when I click on 'Show'. This is the place in my code that fails to perform what I want it to: I'd appreciate any help! The routes.rb: |
How do I check if an element exists inside a jQuery plugin? Posted: 21 May 2016 04:59 AM PDT My question is pretty self explanatory - I'm writing a jQuery plugin where the user specifies a selector. I need to check if that selector exists, and if so, execute some code. However, I can't figure out how to do that check inside of my jQuery plugin. I need to do this because I'm trying to create something like jquery-readyselector (https://github.com/Verba/jquery-readyselector) that works with Turbolinks. I want to be able to use the function like so: Here's my attempt: The issue with this is that that.length == 0, even if the element exists. I also tried defining the function inside a 'ready page:load' but I get pageReady is not a function: Note that I'm using Turbolinks with Rails, and that's why I have that |
Pushing Rails app to Heroku seeing no difference on asset files Posted: 21 May 2016 05:12 AM PDT I have searched over the web & stackoverflow about this topic but could not find a comprehensive guide even in heroku's web site. I have a rails app and when I push the app to heroku here are the steps I am following;
Voila!, but then when I make changes in js and/or css files, I start again from number 1 deleting assets then precompile etc as I mentioned. But sometimes I can not see the differences I make on heroku. When I destroy the heroku app and push again there I see. I am wondering, whether I have to clean Heroku assets as well like Some people say that when you push to Heroku, it resets asset files automatically but then what is the reason sometimes I can not see the differences. When committing to git Thank you |
URL slugs for nested resources Posted: 21 May 2016 05:28 AM PDT In my rails app my models include user.rb item.rb user_item.rb Names for items should never change and cannot be edited by users. A URL for a user would be But what would be best for
|
Storing and Retrieving postgres nested JSONB data type in rails form Posted: 21 May 2016 06:31 AM PDT I realised there is not much information about how to use rails form to store and retrieve JSON type data. I am currently facing the following problem: I have a form that creates a nested structure in JSON: It will generate input HTML tags as such:
I am able to persist it in database after doing I also create However, after I persisted the data, I want it to be shown in the However, it will run into NilClass Error as sometimes I wonder what is the best way to store and retrieve JSON data type. And what is a good way when the JSON is nested. Thanks |
Method returns an Array object Posted: 21 May 2016 06:22 AM PDT My database is PostgreSQL. I'm using the following code to eliminate duplicate rows from a table: Unfortunately the returning object is class of How can I get an |
Delaying Mail with ActiveJobs won Rails 4.2 Posted: 21 May 2016 06:02 AM PDT Looking at
I have a Current Question 1: With the Would this be the same as calling Question 2: Do people add multiple perform methods in their active jobs eg: or is it best to have seperate jobs for a particular task? |
Posted: 21 May 2016 06:05 AM PDT I'm wondering what the best design for the following would look like in Rails: A website with three different image galleries, let's say one showing pictures of the company's staff under I assume it would be bad design to create a gallery resource, along with a productA and a productB resource since there will be only one of each and it's really the new photos and not new image collections which will have to be created. So I'm thinking if it's a good idea to create an images resource and then use single table inheritance, instantiate a gallery_images, productA_images and productB_images and change the routes to the respective ones which I want to show up as URLs. I should probably mention that I don't want to mix up the images for the different sections. I feel there must be a "proper" way of doing this, I guess tons of websites use a similar scheme. |
rails will_paginate with different partials Posted: 21 May 2016 03:40 AM PDT I have some new actions for the notification model and things started getting messy so I refactored from My problem is the following. The page renders everything well, but the pagination doesn't work properly. So IF I have the structure below and doesn't delete notifications_controller.rb other_notifications.html.erb other_notifications.js.erb |
Override Spree 3 Registration Controller Posted: 21 May 2016 03:25 AM PDT Been searching the web for a simple documentation on this task but no avail. I need not to add another model for this. Basically I need to override the spree registration controller and use its user model. All I need to to do, on a custom page, I have a spree login/signin/registration button/link. That will then go to my custom controller to create a new user based on if statements: Then later I modify the spree session controller to know which url the user comes from to redirect. Simple huh? Any docs on this? I'm not looking for this. I'm using Rails 4.2.6 Spree 3.1.0.rc3 |
Can't install gem nokogiri with 2.3.0p ruby Posted: 21 May 2016 03:08 AM PDT Welcome, I tried to install gem mechanize and got stuck at nokogiri gem. Then I tried to install nokogiri gem and got stuck also. Here is my CMD, this doesn't make sense ;/ |
Posted: 21 May 2016 03:55 AM PDT I am wondering if it is possible to make this code even simpler. I am worried t be hitting the database too many times with the same query. Here is my code: Here are the logs: Models Merchant Product Variant Product Partial |
Create an excel in delayed job method using axlsx Posted: 21 May 2016 03:51 AM PDT I am trying to generate an excel file in my delayed job method in model. which is working fine in local. i'm using scheduler to run delayed jobs in heroku. Jobs are getting finished successfully without generating excel. my delayed job method looks like: I'm using delayedjob 4.1. |
Oauth2 access to API by email/password Posted: 21 May 2016 04:09 AM PDT I use gem 'rack-oauth2-server'. Currently I need add access to API by email/password from mobile app. About problem: Gem provide access token from 'oauth/access_token' endpoint. This require next parameters: 'email', 'password', 'client_id', 'secret'. 'client_id' and 'secret' - fields of oauth client from mongodb collection. Client have setting to scope access. I have few user types. For each user type be different access scope(different oauth clients). So, a problem: I want allow get access to api from mobile app for any user type, but, before login, i don't know which type have user. So, mobile app can't know which client_id and sercret should be passwed to 'oauth/access_token' request. Maybe exist some pre-hook for rails requests or another method for add params to request on fly(server side)? Note: before_filter not can be used, because 'rack-oauth2-server' called before callbacks. P.S. Excuse me for my bad English. |
How to have javascript files included only on certain pages Posted: 21 May 2016 12:13 AM PDT I have a WYSIWYG editor that I have built into the site and customised. There are a lot of js files that only need to be loaded on the pages with the WYSIWYG editor and currently thay are loaded on every page (and even break other js certain pages). Currently the js files are in assets/javascript/wysiwyg/ and aren't included as the require files in appliction.js but are still included on every page because of the assets pipeline (I think). I want to know if I can exclude these files from the other pages. Maybe have them removed from the assets pipeline and put the in the public directory or something and have an import statement in the coffee script files associated to the views I want them in. I'm fairly new to rails so I dont know how it all works 100%. Is something like this possible and if so how would I go about doing it? |
In Rails app, jQuery click handler stops working after clicking link to go back Posted: 21 May 2016 04:13 AM PDT I have a page Everything is fine and when an image is clicked I have the desired page The problem occurs when I go back to the Am I missing something? But what? Help is welcome. |
Incrementing dynamic variables in Rails models Posted: 21 May 2016 12:04 AM PDT I am a new RoR user having problems creating non database attributes on my models. The below is the basics of what I'm trying to do, using php code. I want to be able to access the $count attribute in my view. This is what I've come up with using ruby. People on sailing needs to be dynamically counted for each sailing. What I would really like to do is call sailing.people_on_sailing, after putting 'increment' in some sort of constructor. Is something like this possible? |
How to run capistrano tasks over lossy connection? Posted: 21 May 2016 05:13 AM PDT Is it possible to run a capistrano task over a lossy connection? E.g. if the internet drops out or your disconnect wifi, it will resume the command/task when you're back online. I am using capistrano v3x. Thanks, |
Why Rails 5 uses ApplicationRecord instead of ActiveRecord::Base? Posted: 21 May 2016 12:43 AM PDT We know that Rails 5 added But basically, I think every technical requirement we do with ApplicationRecord, we can also do with So now every model will be attached the behaviors of So what is the benefit of using |
uninitialized constant EventController::TempFile Posted: 20 May 2016 11:13 PM PDT I am trying to create a temp file in my rails application. Here is the controller code: I have required the tempfile in application.rb But still i am getting error:
Can anyone how to fix this issue thanks. |
Setting up a rake task with Resque Scheduler - Rails 4 Posted: 20 May 2016 11:57 PM PDT I am on Rails 4 using the Resque Scheduler gem. I am also using the sitemap generator gem in order to dynamically generate my sitemap. I am having trouble figuring out the best way to schedule a rake task with resque scheduler. The sitemap generator recommends whenever, but I am assuming resque scheduler can accomplish the same thing (don't want to install another gem if I don't have to). Does anyone know how to set this up? I would like to run I was thinking I would just schedule a background job and run it from there: ... however, I'm not sure if this is a good practice. Any advice would be much appreciated. |
Nested throttle for API in rails Posted: 20 May 2016 10:37 PM PDT I know there is a lot of gems around throttling API requests in rails, but the problem is their structure is pretty flat - I mean you cannot apply another rule based on other rule happening. Here is the example:
cool, but what if I want to reduce the number of those requests after reaching 100 per day to for example 10 per hour? so something like:
how to achieve that with the use of existing gems avoiding custom solutions as much as possible? |
Rails: Bundle install not working Posted: 20 May 2016 09:33 PM PDT I've generated the app with "rails new" and switched to that directory but when I try to use "bundle install" I get An error occurred while installing debug_inspector (0.0.2), and Bundler cannot continue. Make sure that any suggestions? I'm on OS X if that helps for some reason |
How to get time x days ago from a specific date in Rails? Posted: 20 May 2016 10:03 PM PDT I am looking for a rails solution to calculate the time ago from a particulat time. For example , 2 days ago 15th May 2016 22:00 UTC should return 13th May 2016 22::00 UTC . My requirement is something like this Which will be a more specific version of |
Rails - establish_connection and nested forms Posted: 21 May 2016 06:00 AM PDT I'm having a problem creating a nested model with - The form parameters from the action are (formatted): restaurants_controller |
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