Rails 'select' form for Delete method of RESTful resource | Fixed issues |
- Rails 'select' form for Delete method of RESTful resource
- First capistrano deploy does't make any effect
- Creating two-self joins that share the same parent id
- extconf failed, exit code 1 error when installing [Ruby on Rails] 5 on OS X Yosemite 10.10.5
- Rails: which test method to use
- Changing checkbox icon with simple_form
- how to get 3 week date information using specified date [duplicate]
- Does Postgres hav an equivalent of 'mysqldump --where'?
- How select users where with paid is true and paid_subscriptions expirence_at current date?
- x-editable for bootstrap source selection
- rails-jquery-autocomplete source being an array
- Attempting to generate a URL from non-sanitized request parameters
- Rails Error: "\xE4" followed by "l" on UTF-8
- Are these 2 lines of code the same ? JS vs Ruby
- How to retrieve all related objects from a selection in Rails
- How to query for the products belonging to category and sub categories the correct way
- Pry Debugger - ignore library code
- ActiveRecord::Base.connection.execute(sql).each not returning data
- Organising data for a football (soccer) management simulation
- Accessing devise current_user inside another rails engine
- Can a github repo with gems that can't be bundled provide gems that can be bundled?
- TypeError: $.url is not a function
- Formatting to_json method for child object
- RoR rails_admin associate two models with drop-down to display options
- TypeError: f.browser is undefined fancybox
- Hash Table Column Values as Integer
- Find records with no has_many :through record matching criteria
- fetch different keys with different attributes(params)
- wysihtml5: font size is not overriding earlier font sizes
- Login to facebook with status unknown (rails app)
Rails 'select' form for Delete method of RESTful resource Posted: 11 Jul 2016 08:40 AM PDT This seems like it should be a simple thing, but I haven't been able to hunt down an illustrative example. Apologies if this question is redundant. So I have a rails app, and I'm trying to work with a RESTful resource. This is what the route looks like: config/routes.rb I want a simple form to delete these in case extras are added or whatever. So here are the form and controller I have so far: app/views/articles/_delete.html.haml When I submit this, I get 'No route matches [DELETE] "/articles"'. This is because the route for deletion is articles/:id : So my goal is to get the submit button to grab the id, and send off to /articles/:id with the Delete method. If it helps, I'm on Rails 4.1. I think the real pain point for me here though is not fully understanding how the form helper points to an action or passes data around. If anyone can elucidate I'd be appreciative. I see that I can define a url on the form_for method, like so: But how can I get the id from the form into that url? |
First capistrano deploy does't make any effect Posted: 11 Jul 2016 08:28 AM PDT how is it going? I have a Rails 4 app and I'm trying to deploy it with capistrano 3 on my server. I already installed with I ran this command with the ...and anything was created on the server (current and release folder). Any ideas what I'm doing wrong? I appreciate any clue. EDIT That is my deploy.rb |
Creating two-self joins that share the same parent id Posted: 11 Jul 2016 07:32 AM PDT I've setup two self-joins for my Album model. The first is for album singles. The second is for editions that an album may have (Deluxe Edition, Japanese Edition, etc). Both singles and editions share the exact attributes/associations (name, release date, tracks) which is why I chose to use self-joins vs. creating separate models. For these two self-joins I've created one foreign key, parent_album, since a single and/or edition essentially derives from that one album. I was wondering if it were possible to have self-joins share the same foreign key, |
extconf failed, exit code 1 error when installing [Ruby on Rails] 5 on OS X Yosemite 10.10.5 Posted: 11 Jul 2016 08:30 AM PDT I'm trying to install Ruby on Rails v5 on OS X Yosemite 10.10.5, following the instructions on the rails site: http://railsapps.github.io/installrubyonrails-mac.html When I run this: I get the error And here's part of the mkmf.log file: I have no idea what is going on :(. Can someone help? RUBY VERSION: 2.3.0p0. RUBYGEMS VERSION: 2.5.1 xcode-select is successfully installed. Thanks! |
Rails: which test method to use Posted: 11 Jul 2016 07:52 AM PDT I want to write some tests for my current project. These tests will be mostly related to saved data in the database. For example:
Well, the calculations are bit more complicated before the boolean field is set to true. There are about I did some reading about Rails testing but I could not figure out the exact difference between integration, unit and functional testing in Rails. In my case which testing method will be appropriate? |
Changing checkbox icon with simple_form Posted: 11 Jul 2016 08:37 AM PDT I'm new at rails and web apps and I would appreciate if someone could help with this. Using simple_form and trying to change checkbox icon image but css(scss) seems not working. Codes are below. And SCSS is |
how to get 3 week date information using specified date [duplicate] Posted: 11 Jul 2016 07:04 AM PDT This question already has an answer here:
i am using static day like monday,Tueday,friday and friday. how to get 3 week date after 3 week date..select specified day get 3 week date information. like select monday then get 11/07 , 18/07, 25/07 |
Does Postgres hav an equivalent of 'mysqldump --where'? Posted: 11 Jul 2016 08:10 AM PDT I'm working on a Rails project which uses the multi-tenanting gem Milia. Milia uses row-based tenanting, meaning that every row in the database has a column named The database as a whole is very large, and while there are times when I want the full production dump, much more often I would rather have only data for one tenant. So then I'd like to dump the whole db, but only rows for example, if my database is like this: and I want to dump all the tables where |
How select users where with paid is true and paid_subscriptions expirence_at current date? Posted: 11 Jul 2016 07:44 AM PDT I have model User model PaidSubscription How me write active record query for select all users, where EDIT: |
x-editable for bootstrap source selection Posted: 11 Jul 2016 06:57 AM PDT I have the following x-editable code working: I want to add This didn't work: How can I code this? |
rails-jquery-autocomplete source being an array Posted: 11 Jul 2016 08:15 AM PDT I want to use rails jquery autocomplete but my source is a dynamic array from a field in my model. The documentation https://github.com/bigtunacan/rails-jquery-autocomplete only talks about the source being separate model instances. Is there a way to make it use an array and look at each array item as a separate object when querying the source? |
Attempting to generate a URL from non-sanitized request parameters Posted: 11 Jul 2016 06:23 AM PDT I am getting this error when i try to use the code below, specifically seems to happen when i add params.merge there. What is the real cause and what should i do? full error message
using Rails version 5. |
Rails Error: "\xE4" followed by "l" on UTF-8 Posted: 11 Jul 2016 06:43 AM PDT When I load css or js files on rails 4.2.6 with the link tags javascript_include_tag and stylesheet_link_tag I get the error: Encoding::InvalidByteSequenceError at /app "\xE4" followed by "l" on UTF-8 I never saw this error before. And when I load these same files with the html script like: Then it works. my app/assets/javascripts/application.js is: Someone had this problem before? Thanks! |
Are these 2 lines of code the same ? JS vs Ruby Posted: 11 Jul 2016 05:51 AM PDT In ruby: Javascript: Im coming from a JS background and something peaked my interest when learning about lambdas and Procs where it says that those are function without names which are called. That reminded me of the anonymous functions or IIFE in javascript. Are these 2 examples the same? if not what is the difference ? |
How to retrieve all related objects from a selection in Rails Posted: 11 Jul 2016 08:34 AM PDT In a Rails app I have two models which are related via Given a collection of Entity objects, how can I retrieve all of the related Applicant objects? This works, but is very slow given a large selection: Is there a Rails short-hand to retrieve the Applicants related to the selected Entities? Other things I've tried: |
How to query for the products belonging to category and sub categories the correct way Posted: 11 Jul 2016 06:32 AM PDT Categories and Sub categories are independent models. And each category will have all the sub categories. While creating a product, the admin has to select a category and the sub category. Following are the models I have come up with Here is the schema for the products The product is created with something like this And I am querying all the products that belong to a particular category and sub category like this Is there any thing wrong with the associations I am having? And anything I could do improve this? |
Pry Debugger - ignore library code Posted: 11 Jul 2016 05:44 AM PDT is there an option to ignore standard rails libraries when using step into command in pry ruby debugger? There is a lot of code in ActiveRecord/Rails that makes debugging almost impossible to run efficiently. |
ActiveRecord::Base.connection.execute(sql).each not returning data Posted: 11 Jul 2016 05:50 AM PDT As part of an API application I am working on there is authentication required to make calls. I am attempting the most basic call with a curl command including the header basic authentication. In the authenticate block, which is called when a user attempts to access any secure calls, there is the following code: For some reason this is not returning any results. I have taken the sql outputted from this block and ran it in postgres where it returns the desired row. I have tested my environment to make sure I am connecting to the correct database which I am. Beyond that I am not sure what the problem is or how to diagnose it. Any help would be appreciated. Any suggestions as to how I could return an error from this block would also help greatly. Tried adding exception handling but cant seem to get the syntax correct. |
Organising data for a football (soccer) management simulation Posted: 11 Jul 2016 05:49 AM PDT I'm trying to create an online football (soccer) management game with Ruby on Rails, and as it's quite ambitious for me I'm finding some parts fairly challenging. I've coded a basic match engine, but when it comes to tactics, lineups, formations, etc. I'm finding it more difficult to organise the various data and create relations in ActiveRecord. The same applies to league and cup systems. I'll try to provide a brief overview here:
Any ideas how best to organise this in models? |
Accessing devise current_user inside another rails engine Posted: 11 Jul 2016 05:23 AM PDT So here is my issue. I have a main application which has devise in it,for which I am creating an engine. In the engine I need the current_user from main app. Not sure how I will get that, I tried this link but to no avail. Any help would be great. If this is not recommended please do explain why. |
Can a github repo with gems that can't be bundled provide gems that can be bundled? Posted: 11 Jul 2016 05:14 AM PDT I have a Rails project where a private repository is used to provide several gems, as the bundler docs describe i.e. I have a block like in my The repository, Is there some way to make bundling my Rails app succeed without fixing |
TypeError: $.url is not a function Posted: 11 Jul 2016 05:09 AM PDT I am having a javascript file named _report_js.html.erb file under app/views/reports. WHen I run my application, I am getting the error:
This is my code: |
Formatting to_json method for child object Posted: 11 Jul 2016 05:29 AM PDT I have a Rails object Product: And a Customer object: They are linked via: When I call Product.to_json(methods: [:customer]), I get: But I need this to be in the format: Is this possible? I'm using Rails v4.1.7 |
RoR rails_admin associate two models with drop-down to display options Posted: 11 Jul 2016 05:00 AM PDT sorry for my bad english. I have two models "Blog, Categories", I want a blog has many categories, but it don't working, don't display in the form. My files:
I am newbie in RoR, please help, and thanks C: |
TypeError: f.browser is undefined fancybox Posted: 11 Jul 2016 06:07 AM PDT I am facing error in my app/assets/javascripts/jquery/jquery.fancybox.pack.js file at this line: At top of this file the version is mentioned as: I am using jquery-rails-3.1.4 and jquery-ui-rails-5.0.5 versions. Please help how can I get out of this error. |
Hash Table Column Values as Integer Posted: 11 Jul 2016 05:22 AM PDT I have followed this tutorial to have a hash column on my model which works great. When I work out codes in the My values are shown as an integer, in the console. In my controller, if I'm doing calculations, I have to add The above does not work. |
Find records with no has_many :through record matching criteria Posted: 11 Jul 2016 06:06 AM PDT Using Rails 4, and given the following models: How can I retrieve all Drafts which are not associated with the User instance I have Squeel available if it helps. |
fetch different keys with different attributes(params) Posted: 11 Jul 2016 04:40 AM PDT In this example I receive a key 'tv' and the values x, y, and z. How can I modify this function to receive different keys ? This function can receive different appliances, I can receive a :iron, a :computer etc... with different values. I will only receive one appliance in params. |
wysihtml5: font size is not overriding earlier font sizes Posted: 11 Jul 2016 04:36 AM PDT I have written a small web-app where you can edit documents via the wysihtml5 Editor, like on this site: http://wysihtml.com. after a few problems, quite everything worked fine, but now i recognized that when i change the font-size to 20 and put it back to 14 it still stays on font size 20 and both html-tags are used. Like this: and it looks just a bit bigger than this:
Anyone a clue what it could be? greetings |
Login to facebook with status unknown (rails app) Posted: 11 Jul 2016 04:37 AM PDT view - "facebook_btn_login"
javascript - fb_log_man() javascript - checkLoginState() When run application the status was |
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