acts_as_followers and friendly_id gems not finding id | Fixed issues |
- acts_as_followers and friendly_id gems not finding id
- layout of nested form records, grouped and sorted
- rspec test fails code in rails controller
- localization of paths in spree
- Nested fields causing rollback
- ruby on rails rails new error gem install ffi -v
- Why does d3_rails gem need <script src="https://d3js.org/d3.v4.min.js"></script>?
- Params of multiple choice test
- Rails ActionMailer incorrect param value of message attachment part
- Typeahead.js to search through Users with Ruby on Rails
- Polymorphic for storing information about several objects/entities at a time
- Ruby on Rails: Why Isn't My Nested Form Working?
- applescript error passing a 'rails runner' second command in a do shell script
- Disable pjax in rails_admin
- How to properly work with the Memcached?
- Rails Job Doesn't Proceed after rails jobs:work
- Tuples from Postgres not getting extracted onto the webpage using rails
- adding react-big-calendar will cause Uncaught TypeError: Cannot read property 'matches' of null
- ransack match all associations
- ActiveRecord's serialize converts integers to strings? [Rails]
- why the vagrant windows can ping but can't access in the browser
- Update <li> element class with Javascript for rails loop
- Using Rails 5 enum with PG array
- Show bootstrap modal after successful save to db
- explain to me how this path works and what these error messages mean?
- Migration css rails login form to bootstrap
- What is :format in rails rake routes? [duplicate]
- Rails Google Calendar API
- how to autofill the textfield tag in new.html.erb and save to database using create action
- Can I use Friendly Id on a Rails model without having to create a slug column on the model table?
acts_as_followers and friendly_id gems not finding id Posted: 15 Jan 2017 07:46 AM PST Im using the acts_as_follower gem and friendly_id gem. Iv set up acts_as_follower and everything is working as it should, I am able to follow But now the This is the set up what I'm trying now, but this still does not work. Before it was: The error I'm getting is: There params that are being passed are: the id its now looking for is the friendly url Also the new friendly_id version requires i find profiles like this: |
layout of nested form records, grouped and sorted Posted: 15 Jan 2017 07:30 AM PST The standard rails way to call nested forms where This generates n replications, based on the controller build command, or the number of children in existence. However, if various groupings are required The number of records handled is a square of the number of regularitems (multiplied by itself). Is there any way to use the helpers in a way that allows such groupings; if not, how can this structure be maintained to allow editing of the nested records? Note: the above is a simplified version, as there would be two levels of [ahem] nested groupings |
rspec test fails code in rails controller Posted: 15 Jan 2017 07:47 AM PST In my application_controller.rb, i have a line of code as follows: In my rspec code, i have a line of code that visits the index path of application_controller as follows When i run the code directly, it works perfectly but when it visits application_controller.rb via rspec, i get an error which says Not sure while i get this error via rspec and capybara but if i run the code as It executes perfectly with no errors. Kinda confused what the i get this error |
localization of paths in spree Posted: 15 Jan 2017 07:16 AM PST I am adding new pages to my Spree application, (via spree_static_content and spree_contact_us). However the link to these pages is not getting the proper locale(the link is localhost:3000/contact-us instead of localhost:3000/es/contact-us). Where can I set it? I have messed around with routes but without any luck. I am interested in understanding how is the locale inserted into the path. I am using spree-i18n as localization gem for spree. |
Nested fields causing rollback Posted: 15 Jan 2017 06:43 AM PST So I am facing this problem where nested field is causing a rollback on submit. I am using rails 5. Here is the new and create actions of the controller Here are the params Simplified form_for In match.rb I have and in hero.rb I have I get a rollback on pressing submit and on running @match.errors.full_messages I get ["Heros match must exist"] Any help would be greatly appreciated. Edit: Views are in haml. |
ruby on rails rails new error gem install ffi -v Posted: 15 Jan 2017 06:19 AM PST good day Today starting to study ruby on rails I find this error when creating a new application /Users/Manux/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.17/gem_make.out An error occurred while installing ffi (1.9.17), and Bundler cannot continue. Make sure that I use ruby-2.1.1 and rails 5.0.1 |
Why does d3_rails gem need <script src="https://d3js.org/d3.v4.min.js"></script>? Posted: 15 Jan 2017 05:23 AM PST I am learning D3.js in order to replace Highcharts in my application, so it can be released under GPL license. Here is how I installed it: 1 - I declare the d3_rails gem in the Gemfile 2 - I require d3 in the application.js file The call to d3.js methods (from within a RoR partial) did not work until I add this to the partial: Why do I have to declare this again here? Thanks for your help. |
Params of multiple choice test Posted: 15 Jan 2017 05:17 AM PST I have a view using form which acts like multiple choice test, so there might be more then one correct answer. What I need to do is create param containing array of arrays that lets me easily iterate through it in controller. For now I am using erb which produce param looking like this: For example: Where task1 is first question, task2 is second question and consist of array with answers chosen by user. To iterate through that I would have to use metaprograming, but it's the last thing I would like to do. Code of my view: So the question is: do you know more elegant and optimal way to do it? Do I have to use metaprogramming? |
Rails ActionMailer incorrect param value of message attachment part Posted: 15 Jan 2017 07:40 AM PST Mailer code which send message with attachment file: When I open this message in the mail web-client (mail.yandex.ru) that it does not show the number of attachments, example: So, I compared correct and incorrect message parts: correct incorrect: As you can see the incorrect message has param=nil for Net::IMAP::BodyTypeBasic object. How I must send message with correct param value of attachment part? |
Typeahead.js to search through Users with Ruby on Rails Posted: 15 Jan 2017 05:01 AM PST I am kinda new to Ruby on Rails. In my application there are users and I want users to search for another users by their name, username, surname etc. I am using typeahead.js from the source https://twitter.github.io/typeahead.js/ Somehow when I hit enter on the search bar nothing happens. All i got is a question mark like this http://localhost:3000/home? any help would be appreciated. Thanks! I have this on my routes.rb get '/users/typeahead/:query' => 'users#typeahead' gemfile gem 'twitter-typeahead-rails' app/assets/javascripts/application.js //= require typeahead app/assets/javascripts/users.js var onReady = function() { // initialize bloodhound engine var searchSelector = 'input.typeahead'; var bloodhound = new Bloodhound({ datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.value); }, queryTokenizer: Bloodhound.tokenizers.whitespace, // sends ajax request to remote url where %QUERY is user input remote: '/users/typeahead/%QUERY', limit: 50 }); bloodhound.initialize(); // initialize typeahead widget and hook it up to bloodhound engine // #typeahead is just a text input $(searchSelector).typeahead(null, { displayKey: 'name', source: bloodhound.ttAdapter() }); // this is the event that is fired when a user clicks on a suggestion $(searchSelector).bind('typeahead:selected', function(event, datum, name) { //console.debug('Suggestion clicked:', event, datum, name); window.location.href = '/users/' + datum.id; }); }; I have typeahead.js in the following place vendor/assets/javascripts/typeahead.js My User Model user.rb def search_name_like search.where("name ILIKE ?", "%#{name_like}%") end def search_typeahead search.where("name ILIKE ?", "%#{typeahead}%") end And the controller users_controller.rb # GET /users # GET /users.json def index @search = User.new(search_params) @users = search_params.present? ? @search.results : User.all end # GET /users/typeahead/:query def typeahead @search = User.new(typeahead: params[:query]) render json: @search.results end private def search_params params[:user] || {} end the view is like _nav_user.html.erb layouts/_nav_user.html.erb div class="form-group" input class="typeahead" type="text" /div |
Polymorphic for storing information about several objects/entities at a time Posted: 15 Jan 2017 05:20 AM PST Say, I have a model Activity. And I want to use it as a model for kind of news or event happening on my website such:
There always be a connection to a User. And to something else: Article, News, Comment, Picture, Profile. How can I implement this? I can do this: But when I'm creating an activity, how would I specify all the IDs involved? For example: "A user has added a comment for an article". There're 3 entities here. User id is captured via "belongs_to :user". But either Comment ID or Article is captured via "belongs_to :with_activity, polymorphic: true" and not both. Whereas I want both. Or more if needed: "A user has added a comment for a picture of an article". -- 4 entities, but only IDs of 2 of them are captures. I need to store all their IDs. "polymorphic" allows to store only an ID of a single entity. How can I get around of that? Should I add "belongs_to" :picture, :article, :comment and so to Activity? Is there a better solution? Note that I don't want to use a gem for that. |
Ruby on Rails: Why Isn't My Nested Form Working? Posted: 15 Jan 2017 04:47 AM PST I have followed the RailsCast video into creating nested forms: http://railscasts.com/episodes/196-nested-model-form-part-1?autoplay=true But for some reason it isn't saving. When creating an email I am trying to create records in the recipients table, so that it can be recorded which groups and contacts the email was sent to. This works but I am also trying to save data to a column called "message" in this table, but for some reason the new record in the recipients table is made but the message is not saved in the table. My models are: My And my Can someone please help me work out why the |
applescript error passing a 'rails runner' second command in a do shell script Posted: 15 Jan 2017 04:13 AM PST I am running Works fine if I manually enter the commands in terminal and it also works if i set the commands in a window terminal like Though i want to use the applescript output, and doing do shell script "" seems to get me what I need. Im unable to get the output any other way. unfortunately I keep getting this error: This question looks very similar to my problem with this answer related to loading "sh" environment instead of user's. But I cant seem to get the path/command working. |
Posted: 15 Jan 2017 04:16 AM PST I use the rails_admin gem, and without adding any custom javascript to it, I get Any idea on how to fix this ? It causes my tests to fail. It look like this could be caused by pjax (from what I read on some SO posts). I tried disabling it using: But it fails in: Where am I supposed to add it ? Any input will be much appreciated ! |
How to properly work with the Memcached? Posted: 15 Jan 2017 03:56 AM PST There are RoR project on Ubuntu server. I installed on the operating system Memcached: And also for Ruby was installed gem Configuration for production: As for caching, then I'm basically apply the caching fragment in cycles. For example, the caching news, I implemented as follows: As for the caching in action I searched in google and found many examples of implementation, but still adhered to the official documentation (official examples) of Rails. Memcached server is specified as localhost specifically - I do not have the possibility to take a separate server for the cache. I am interested in Expert opinion: I did everything right? What are the pros and cons of the current implementation of the cache? |
Rails Job Doesn't Proceed after rails jobs:work Posted: 15 Jan 2017 04:13 AM PST I have a job in my rails app which I was running it before like a charm with this command: but it doesn't proceed any longer.I killed the processes and tried a lot of solutions but nothing happened! What I guess is that this job has generated a queue so that it can not be running any more! Could you please help me? Thanks in advance. It stops in this situation : and my job : FYI |
Tuples from Postgres not getting extracted onto the webpage using rails Posted: 15 Jan 2017 05:23 AM PST I'm trying to develop a simple blog app using rails 5.0.1 and Postgres The problem is that,although 3 tuples are stored in the db (I checked it), when I extract it using "@posts=Post.all "command, only 3 horizontal lines occur(I.e the 3 tuples are scanned but not displayed). The code : |
adding react-big-calendar will cause Uncaught TypeError: Cannot read property 'matches' of null Posted: 15 Jan 2017 02:46 AM PST reproducing repohttps://github.com/github0013/ror_rbc/commit/246f6e1839cdd6aababeeacb9301a80b040e453d problemI am using things I checkedhttps://github.com/intljusticemission/react-big-calendar why document is null?I am quite new to reactjs, webpack and etc, so I am sure I am missing some basic knowledges, but if anyone can point out why document object is missing, please let me know. |
ransack match all associations Posted: 15 Jan 2017 02:56 AM PST I have When I search using the list of skills names or ids. I need get users have all values in this list. So, Search using The Problem if I used ransack gem If it's not allowed in ransack. Can you help How make it in ActiveRecord & run in DB level? My Opinion: It's can't implement using ransack params, If you know Native Query to match all association, let me know? |
ActiveRecord's serialize converts integers to strings? [Rails] Posted: 15 Jan 2017 02:48 AM PST When I am persisting a hash as a JSON, I expect the hash to be converted to JSON and not modified, but instead the keys are changed from integer to string. The model: Usage: Any ideas how to make ActiveRecord not mangle my input? |
why the vagrant windows can ping but can't access in the browser Posted: 15 Jan 2017 05:33 AM PST i spend a hold day to build the vagrant env on the windows ,and use the rbenv build the ruby env & install the rails ! evrythings ok,but when i start the rails s found i can't access on the chrome,then i use the ubuntu links to ping the 127.0.0.1:3000 it's ok,but ping the 192.168.10.10:3000 told me the connection refused! that's my vagrantfile setting ,just only setting the private_network ip anyone else can tell me how to resolv the problem? |
Update <li> element class with Javascript for rails loop Posted: 15 Jan 2017 04:08 AM PST I'm designing an application to store sport games. Now in my notifications I have a list of games to confirm, in my list I have the read and unread class options and also an action to confirm the game. Now when someone confirms a game I don't want a page refresh, however the class should change in read and the button should disappear. Could someone help me with this Javascript? I kind of a noob in Javascript so sorry if this is a stupid question. A little recap: When This button is clicked, it should disappear and also should change to |
Using Rails 5 enum with PG array Posted: 15 Jan 2017 01:27 AM PST I'm trying to use Rails' enum with PostgreSQL's array column. However the above code does not work. Is there any way to using enum on array column like |
Show bootstrap modal after successful save to db Posted: 15 Jan 2017 01:15 AM PST I have a basic email entry form on my home page, and if the subscriber's email is saved I want to redirect them back and display a bootstrap modal. I've thought about sending a Basically, I'm wondering two things:
/controllers/subscribers_controller.rb: |
explain to me how this path works and what these error messages mean? Posted: 15 Jan 2017 12:09 AM PST here is the route: which gives url www.example.com/tags/food I figured out that the correct path is
if i just do
|
Migration css rails login form to bootstrap Posted: 15 Jan 2017 01:27 AM PST Need help migration to bootstrap. bootstrap sound easy just go get all scss and samples to paste. But I don't know how to insert "@user, url: signup_path" into/or replace in bootstrap code to work in rails app. html: Bootstrap code: from getbootstrap |
What is :format in rails rake routes? [duplicate] Posted: 14 Jan 2017 10:34 PM PST This question already has an answer here:
What does the format below stand for? I know it's not necessary but what is it referring to? |
Posted: 14 Jan 2017 10:26 PM PST First time trying to use the google calendar gem in my rails app. What I am hoping to do is Post to the google calendar API's 2 users or email addresses of some sort and then try to find a free/busy schedule for both emails. One of the emails will be authenticated through oauth and the other emails calendar is normally visible to the user who has been authenticated. Is this possible? Any advice or pointers in the right direction are greatly appreciated! Tyler |
how to autofill the textfield tag in new.html.erb and save to database using create action Posted: 14 Jan 2017 10:34 PM PST I've been able to autofill my text field tags but if i hide them by doing <% instead of <%= they dont save to my database any suggestions? Heres the create action in the bid controller that this form is connected to heres the page the user show page where the bids will show up on which works as i said when text fields are added manually. |
Can I use Friendly Id on a Rails model without having to create a slug column on the model table? Posted: 14 Jan 2017 11:44 PM PST On Rails 4.2, I would like to use Friendly Id for routing to a specific model, but dont wan't to create a slug column on the model table. I would instead prefer to use an accessor method on the model and dynamically generate the slug. Is this possible? I couldn't find this in the documentation. |
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