Getting undefined method `acomments' for nil:NilClass error [on hold] | Fixed issues |
- Getting undefined method `acomments' for nil:NilClass error [on hold]
- unicorn_rails command not found in shell script
- Send ajax data from controller to view of another controller
- Rails Form Object errors not persisted
- How would I go about allowing users to create surveys
- Invoke Flash Notice in Rails using [action].js.erb
- Rails nested form fields not displayed
- Nested query parameters in Swagger 2.0
- Functional testing devise user with custom roles ,rspec
- Rails Timestamps UTC vs
- How can I stop Heroku Dyno that is running the Rails task through Heroku Scheduler?
- Rails: Toggle switch label helper
- How to check rails application properly connected to MSSQL database or not
- Displaying currency symbols in form dropdown menu
- Add a new action to existing controller or add a new action to a new controller?
- Sending CSV attachment with action mailer & AWS Sqs queue
- What is difference between scheduled_delivery_date, actual_delivery_date, ship_time in active_shipping gem
- Rails: Redirect form_tag with radio button to 'show' page
- kaminari show current page + 5 links
- How to make devise gem go to specific page when user logs in for the FIRST time using confirmation email link but only in this situation
- Sorcery Simple Login with username
- Move views javascript code to javascript files
- Rails forms, change field name dynamically with iteration variable?
- Modifying create method for nested form model
- Rails 4.2 STI // Wrong casting (Superclass instead of Subclass)
- Axlsx in Rails: rendering formula issue
- Is there a way to combine where and where.not into one condition in Rails?
- Is it possible to cross reference FB taggable_friends and local user records under API v2?
- Rails group_by and sorting upon field in related model
- Does Rails streaming need to finish template generation to output the template?
Getting undefined method `acomments' for nil:NilClass error [on hold] Posted: 11 Aug 2016 07:41 AM PDT I am bulding a Question and Answer app where each Question has many answers and many comments. Each answer has many acomments (Answer comments). I am getting undefined method `acomments' for nil:NilClass error. Below is my Acomments Controller. AComment model: Answer model: Answers view: Could someone please tell me where I am making a mistake. |
unicorn_rails command not found in shell script Posted: 11 Aug 2016 07:37 AM PDT I run But when I use a shell script to run this command, get errors: my script: |
Send ajax data from controller to view of another controller Posted: 11 Aug 2016 07:43 AM PDT I have a situation that I want to send data from "Relationships" controller to a view that belongs to "profile" controller.this system Is working but not the ajax section.I have to refresh the page each time that I want to see the results. Here is my code: /profiles/show.html.haml // follow.js.erb (inside profiles folder) // unfollow.js.erb (inside profiles folder) |
Rails Form Object errors not persisted Posted: 11 Aug 2016 07:31 AM PDT Hi there I am trying to use the Form Object refactoring technique but I am having trouble getting the errors to stick. I have the following Do I have to include some other Rails specific libraries in order for this to work? Thanks! |
How would I go about allowing users to create surveys Posted: 11 Aug 2016 07:42 AM PDT Iv'e gotten myself into a bit of a brain mess up these past two days. I'd like to be able to allow my users to create a campaign (same concept as surveys), it will allow them to request certain data they wish such as an email address. This will then allow the person completing the form to proceed and receive a download link after entering an email. The email entered should be stored for the person who created the campaign to view. Iv'e taken the approach with nested forms, however I ran into the trouble of allowing emails to be entered and saved for the campaign creator to view. Any help is appreciated, thanks. campaign.rb model
query.rb model
result.rb model
schema.rb Part of campaign_controller.rb |
Invoke Flash Notice in Rails using [action].js.erb Posted: 11 Aug 2016 07:44 AM PDT I am trying to get the rails flash notice to appear within my application by using JavaScript only. I have a form which leverages The rails application was generated using rails-composer which also installed bootstrap css. The controller then invokes the The Any assistance on how I can get the flash notice to show up via JavaScript would be much appreciated. |
Rails nested form fields not displayed Posted: 11 Aug 2016 07:11 AM PDT I can't figure out what am I doing wrong in this simple nested form that it is not displaying nested fields. Moreover if I change Models Controller View |
Nested query parameters in Swagger 2.0 Posted: 11 Aug 2016 06:59 AM PDT I'm documenting a Rails app with Swagger 2.0 and using Swagger-UI as the human-readable documentation/sandbox solution. I have a resource where clients can store arbitrary metadata to query later. According to the Rails convention, the query would be submitted like so: which Rails translates to params of: which can easily be used to generate the appropriate Is there any support for something like this in Swagger? I want to ultimately have Swagger-UI give some way to modify the generated request to add on arbitrary params under the |
Functional testing devise user with custom roles ,rspec Posted: 11 Aug 2016 06:54 AM PDT I have user model with role field for user,admin and super admin which are in enum roles. I wrote function in controller_macros.rb for super admin sign in: And i have this test: This tests response code is 302, i can't figure out why, i think it never reaches controller new action, because i placed debugger to catch it. Why this happens? |
Posted: 11 Aug 2016 07:30 AM PDT I'm getting a failing rpsec test and it seems like it's a difference between the system clock and how Rails evaluates the time. ``` ``` For some reason Does anyone know why or where this happens? |
How can I stop Heroku Dyno that is running the Rails task through Heroku Scheduler? Posted: 11 Aug 2016 07:12 AM PDT Heroku Scheduler uses a One-off Dyno to run the scheduled task. That dyno doesn't appear in Heroku Dashboard, but it's there. How can I restart it, or temporarily stop it? |
Rails: Toggle switch label helper Posted: 11 Aug 2016 06:23 AM PDT I have this toggle switch in HTML. What would be a clean Rails implementation for the form label? I appreciate any help you can provide. |
How to check rails application properly connected to MSSQL database or not Posted: 11 Aug 2016 07:21 AM PDT How to check rails application properly connected to MSSQL database or not(in controller/model) Can anybody assist me on this? |
Displaying currency symbols in form dropdown menu Posted: 11 Aug 2016 07:30 AM PDT I have a form in my real estate rails application where users can add a real estate listing. In this create#apartment form, I'd like the user to be able to select (from a dropdown menu) what currency their pricing is in. I've created a Currency model, views and a controller so the admin can add currency types. (I want the admin to be able to limit currency types). Here is the currency migration file: (The "symbol" being a string that holds the currency HTML code) I connected Currency and Apartment with a belongs_to/has_many relationship in the db. I then implemented a dropdown menu in the create#apartment form where users can select the currency. My question is, how can I display the currency symbol in the dropdown menu? Here's what I tried. The problem is, this doesn't display the currency symbols as I would have hoped; it just displays the string that was entered (the currency HTML code). For example, with the code as it is, if an Admin entered the currency HTML code for $ ($), the dropdown shows "$" isntead of the expected "$") Thanks in advance!! |
Add a new action to existing controller or add a new action to a new controller? Posted: 11 Aug 2016 07:27 AM PDT RoR4 app. I have a page X which shows pricing stuff in an eCommerce website. So there is a pricing controller with index page showing the pricing content. There is a purchase button which needs to do following things:
My dilemma: Should I add a new purchase controller? or add a new method purchase in existing controller of pricing. |
Sending CSV attachment with action mailer & AWS Sqs queue Posted: 11 Aug 2016 05:44 AM PDT I am trying to send an email with a CSV attachment from a Rails AWS EB application (worker tier). This example will send the email correctly with the data attached, I have hardcoded the CSV string here; However when I send the CSV string from the API I seem to have an encoding problem. The object I am sending is this; And the method; I think there may be a problem with the transfer_encoding, If I do not set it to '7bit' the content is base64 encrypted. I have used the action mailer method attachments.instance_values to check the content_encoding of the email that works and its binary, however it I set it as binary in the failing example it reverts to base64. If I set the params[:attachments][:content] as a variable then when I log the attachments.instance_values the value is 'binary' but when the mail is received the message is; any help or suggestions appreciated. |
Posted: 11 Aug 2016 05:39 AM PDT I am using active_shipping gem to integrate shipment tracking from Fedex and UPS. I want to get the estimated time by when the package will be delivered. Tracking response from active_shipping contains of scheduled_delivery_date, actual_delivery_date and ship_time. I am unable to find documentation on above terms. From the name I can guess that scheduled_delivery_date is the estimated delivery date when package will be delivered to the said address and actual_delivery_date is the exact date on which the package was delivered. Also I have no clue about ship_time. I have another concern too, when I try to test fedex by using test tracking number it returns nil for scheduled_delivery_date and actual_delivery_date. Extra Info: Tracking number that I tested with have 11 shimpent_events and last one is delivered event, so i expect tracking response to have scheduled_delivery_date and actual_delivery_date. Delivered shipment event shows date of 'Thu, 09 Jan 2014', while ship_time is show as 'Mon, 01 Aug 2016' Is this happening because I am using fedex in test mode. Will everything be fine in production mode? Can anyone please help me to understand or point me to documentation which explains scheduled_delivery_date, actual_delivery_date and ship_time. Thanks :) |
Rails: Redirect form_tag with radio button to 'show' page Posted: 11 Aug 2016 05:35 AM PDT I'm a rails noob, and no matter what I do, when I use my radio button I can't get it to redirect to where I want. In short, I want to "show" the post id that the user has radio clicked when he clicks the submit button. My feeble attempt so far is this (_searchresults.html): And then my radio button: And my submit_tag: I want clicking that submit tag to go to this url: localhost:3000/posts/10 ^^^ where "10" is the post id of whatever post was clicked on the radio button. Instead, it's going to this url: localhost:3000/posts.post_id?utf=.&post_id=10 ^^^^where utf equals a checkmark, not a dot, but I couldn't type that in I don't understand why it won't go the URL I want. |
kaminari show current page + 5 links Posted: 11 Aug 2016 05:06 AM PDT I have a rails application where I am using kaminari. I have following code in a partial When on first page it shows links 1 to 5 eg: 1 2 3 4 5 ..> Then if I go to 5th page it shows like this < 1 2 3 4 5 6 7 8 9 … > What I want to do is show current page plus next 5 pages links. eg. If I am on page 10 I should see < 10 11 12 13 14 15 ..> Does anyone know if this is possible ? |
Posted: 11 Aug 2016 05:07 AM PDT so i am trying to build a social network for rails practise that using devise gem asks the user to confirm email in order to enable login. My problem: I want the user to fill a form when he/she logs in for the very first time. This first time happens when they click on the link in the confirmation email. All the other times the user logs in goes to a different page. How can I do this? |
Sorcery Simple Login with username Posted: 11 Aug 2016 04:30 AM PDT I'm working on a blog website written in RoR and got stuck on a problem with Sorcery. I did the tutorial from their documentation to create the simple login. My problem is, that they use email to identify the user at the login. So I tried to modify my session controller to send the username as parameter instead of email and modified my view accordingly. The log says that everything works fine and the username and password is passed to the database. But, and I can't find a solution to that, the SQL string that's generated still uses "authors"."email" as parameter. How can I fix that? My log: My session controller: My new.html.erb |
Move views javascript code to javascript files Posted: 11 Aug 2016 07:45 AM PDT First let me tell you that I've searched for this and didn't manage to find any answer for my problem. I have a lot of Javascript on my layouts/application.html.haml file: And I'm using instance vars within this code, which means that this vars will only be declared on the controller (application controller). As this is the application layout, these scripts run on every page of my website (and that's what I need of course). What I want is to move all this code to a js.erb file (or .haml if possible). First - because is easier to manage this code in a separate file; Second - because I don't want to have Also I'm including already the |
Rails forms, change field name dynamically with iteration variable? Posted: 11 Aug 2016 04:21 AM PDT I have an iteration for all my locales. I want the :text and :title field on every iteration to change depending on the locale, for example :title_en for English, :title_ru for Russian, :title_gr for Greek and so on. The "en", "ru", "gr" and so on are the locale in my iteration so I get them from there. How do I go about that? What is the best way to do it? |
Modifying create method for nested form model Posted: 11 Aug 2016 04:13 AM PDT I have a I'm aware that you can approach this by doing something like |
Rails 4.2 STI // Wrong casting (Superclass instead of Subclass) Posted: 11 Aug 2016 04:12 AM PDT I'm trying to implement an STI pattern in my Rails application and I'm going to get crazy. I have three models: Superclass: Subclasses: I want to get a Subclass instance, calling Superclass, e.g.
I've been looking for an answer and I found out it's because of an eager load in a development environment. Following the advices, I've been trying with these parts of code: In initializers: In Superclass: In the bottom of Superclass: But it still doesn't work. Has anyone any idea, how to make it work? This concerns |
Axlsx in Rails: rendering formula issue Posted: 11 Aug 2016 06:35 AM PDT When I pass formula to For example: Method I need to have the result of calculated formula, not a text. Any ideas? |
Is there a way to combine where and where.not into one condition in Rails? Posted: 11 Aug 2016 03:56 AM PDT I have an But can I combine these 2 I know that if I need to find, for example, events with specified and I can compact it using one but can I do the same thing if I am using |
Is it possible to cross reference FB taggable_friends and local user records under API v2? Posted: 11 Aug 2016 03:43 AM PDT I am using Koala in a Rails app to get a user's friends for a simple tagging interface. Some time back, Facebook changed the API (v2.0) such that this end point now returns a hashed ID, rather than the friend's FB ID. I've just started working with this endpoint for the first time since the change and am wondering, is it still possible to correlate an FB taggable_friends with a user of my app. For example, within my app a user creates an event she attended, and now wants to tag friends she was with. The taggable_friends API allows taggings to be pushed to FB, but how do I also represent that tagging within my app? The Is there any way to cross reference taggable_friends with local user records under the new API? |
Rails group_by and sorting upon field in related model Posted: 11 Aug 2016 03:44 AM PDT I have a User that belongs to a User_type. In the user_type model, there's a field called position to handle the default sorting when displaying user_types and their users. Unfortunataly this does not work when searching with Ransack, so I need to search from the User model and use group_by to group the records based on their user_type_id. This works perfectly, but I need a way to respect the sorting that is defined in the user_type model. This is also dynamic, so there's no way of telling what the sorting is from the user model. Therefor I think I need to loop through the group_by array and do the sorting manually. But I have no clue where to start. This is the controller method: How do I manipulate that array to sort on a field that in the related model? |
Does Rails streaming need to finish template generation to output the template? Posted: 11 Aug 2016 03:19 AM PDT I've been setting up Rails streaming. I have it working so that the top of the layout is rendered immediately, but when it outputs the template, it seems to process the whole template before flushing it. e.g. Let's say I have a standard layout with etc, then I have a template like this, with a simulated pause in the middle: Now when I curl this, I will see: Is this expected behaviour? I thought it would render the template as it's being processed. (Hamlit is the template engine, if that matters.) |
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