mongoid .where queries not working as expected | Fixed issues |
- mongoid .where queries not working as expected
- Multiple Devise Models resource_name error
- Change angular-materials md-tooltip text dynamically through controller
- From Rails Tutorial Ch8 - why is instance variable not used?
- Run my own code only after started the rails server
- No confirmation messages after submit
- How do I overcome "unknown encoding name - macintosh" error with Nokogiri?
- login devise teacher model using TeacherID while student model using email
- Can a private channel communication happen between two Pusher Apps
- Rails PSQL JSON query: find the nested array element at unknown position?
- Rails 5 - data validation gems
- How Do I Implement a Popover in a Rails Partial Using Bootstrap 3?
- URI.parse(url).open not working on heroku
- Rails remove column that has no data type
- Workaround help! Alternatives to using .where on ActiveRecord associations?
- Use a carousel as a form element
- Rails activejob with Sidekiq is spawning multiple jobs on perform_later
- rails how to get the following query in rails
- Get a model reference from ActiveRecord_Associations_CollectionProxy object
- wrong number of arguments Contact#create
- Devise yielding password in plain text?
- Ruby on Rails - Editor only for code
- Rails how to version the models?
- js doesn't load properly with ruby on rails
- Undefined local variable or method Rails4.2
- Selenium+Ruby issue because of page reload
- Rails favicon on deeply nested routes
- Rubymine - connect to database in docker container
- how to watch a sass file
- Ruby on Rails - old version deployment
mongoid .where queries not working as expected Posted: 11 Oct 2016 07:43 AM PDT I have a model that belongs_to another: And a corresponding has_many model: I am seeing that 2 basic ActiveRecord queries are not working: First, sending the object instead of the object id does not work: However, if I use the id, it works fine: Second, sending an array of ids does not work, ever: Does mongoid not support basic ActiveRecord queries? If not, for the first problem, I can work around it by always using the object id, but for the second, how do I search by an array of targets? Thanks for any help, Kevin |
Multiple Devise Models resource_name error Posted: 11 Oct 2016 07:37 AM PDT Error I am getting is undefined method `login' for Model1:0x007f2a914d0d10 although in the form i am passing resouce2 and resource_name2 then why is it saying undefined method login for Model1 here is my model2 applicationhelper login form |
Change angular-materials md-tooltip text dynamically through controller Posted: 11 Oct 2016 07:26 AM PDT I am rendering the following HTML which introduces a tooltip by Angular-Material and an input-field which gets initialized as DatePicker. As you can see it is inside a Inside our Angular-Controller we want to change the text of this tooltip based on certain conditions. We further use jQuery to manipulate the respective part of the DOM. The following represents how the above code will render in HTML: The following code gets called to ultimately manipulate the tooltip: Unfortunately the change does not have an effect on the tooltips text. While the If you have any input on this, it'd be highly appreciated! Thanks in advance! |
From Rails Tutorial Ch8 - why is instance variable not used? Posted: 11 Oct 2016 07:30 AM PDT Currently working through Hartl's Rails Tutorial in Ch 8 where he gets you to write code for users to log in and stay logged in. Under method logged_in?, why is local variable |
Run my own code only after started the rails server Posted: 11 Oct 2016 07:34 AM PDT I know initializers and The question is, how can I run my own code only after started the rails server? |
No confirmation messages after submit Posted: 11 Oct 2016 07:07 AM PDT I'm working in a Rails 4.1.0 application in cloud9 IDE. I enter test info in the fields: Name, Email, Comments, in the Contact Us form page, clicked submit and the following info displays in the address bar with no 'Message sent' confirmation: I entered no info in the fields (blank), clicked submit, the blank info is displayed in the address bar, again no 'Error' confirmation message: I enter bundle exec rails c and Contact.all in the console, no entries are listed here and no entries are saved to the database: Contact Load (2.9ms) SELECT "contacts".* FROM "contacts" => # I tried to figure out what the problem is in my code, having made several changes, but to no avail. Someone might notice something I do not. Here is my code for perusal and advice: New.html.erb Contacts_controller.rb routes.rb application.html.erb |
How do I overcome "unknown encoding name - macintosh" error with Nokogiri? Posted: 11 Oct 2016 07:12 AM PDT I'm using Rails 4.2.7. I'm currently using the following logic to parse a doc with Nokogiri … In my HTML document, this content appears within my "text-results" block … I include this section because my parsing dies with the following error … Is there any way to make Nokogiri ignore this unknown encoding? I'm trying to get the content inside the "pre" tag as text, so I don't need it parsed further. Edit: I'm on Mac El Capitan. Per the comment, here's my locale settings |
login devise teacher model using TeacherID while student model using email Posted: 11 Oct 2016 06:41 AM PDT Is it possible to allow one devise model login on basis of the username or some other unique id while other one using default devise email authentication process. |
Can a private channel communication happen between two Pusher Apps Posted: 11 Oct 2016 06:15 AM PDT I have two iOS apps, lets call it Agent app and Customer App. I have a chat feature between these two apps, but the chats need to be recorded on the server. I have created two Pusher Apps, one for each of the iOS apps. They both subscribe to their respective Now every time a message is generated from say Agent app (via HTTP request to server), I want server to create a pusher event with Agent's message on Customer's private channel. Is it possible to achieve the above using Pusher Private channels? |
Rails PSQL JSON query: find the nested array element at unknown position? Posted: 11 Oct 2016 06:31 AM PDT Please see an example here: http://edgeguides.rubyonrails.org/active_record_postgresql.html#json How do I get all the records containing I can currently do it with such a query: But what if I don't know the exact |
Rails 5 - data validation gems Posted: 11 Oct 2016 07:27 AM PDT In my app that I am building to learn RoR, I want to start learning more about validations. Besides building custom validations (e.g. using regex), I was wondering what the best gems are for commonly found validations for data like addresses, currencies, dates/time formatting, languages, etc.? This in order to build a basic set to use on new apps. I came across these below to use:
How about incoterms, unit of measure (from UNECE or ISO20022) or VAT id? Any other ones that I should look at? |
How Do I Implement a Popover in a Rails Partial Using Bootstrap 3? Posted: 11 Oct 2016 05:12 AM PDT I currently have a Rails 4 application running Bootstrap 2 (gem twitter-bootstrap-rails 2.2.8). I was successful in implementing a popover using partials where a map is displayed when a link is clicked. Here is the code that I have. application.js bootstrap.js.coffee _map _map_marfa _map_bigbend When I click either link the map display below and stays there until the person clicks the link again to close the map. I have copied the code to my new Rails 5 Bootstrap 3 application. Here are the code changes for Bootstrap 3. application.js bootstrap.js.coffee was renamed to bootstrap.coffee _map Now when I click either link the map displays and immediately disappears instead of staying until the link is clicked. |
URI.parse(url).open not working on heroku Posted: 11 Oct 2016 04:45 AM PDT So I just added the option to upload images by url using this action and it's working in development but not in heroku. I'm using paperclip to save he images on AWS. I'm not getting any errors too. I tried without .open it worked in development but not in heroku. Any thoughts on this? |
Rails remove column that has no data type Posted: 11 Oct 2016 05:22 AM PDT In my Rails 5 application I've accidentally created a column with no data type. Database is SQLite. When I attempt I've tried running this migration: But I think SQLite doesn't support dropping columns. Is there a fix for this? |
Workaround help! Alternatives to using .where on ActiveRecord associations? Posted: 11 Oct 2016 06:37 AM PDT I'm using a gem and can't seem to use I'm looking for a workaround solution for a query such as:
Are there any alternatives to using Can anyone help? Thanks! |
Use a carousel as a form element Posted: 11 Oct 2016 04:36 AM PDT I'm working on a object where as part of a form I'd like the user to be able to select from a number of images in a carousel. I can then access the index of the carousel using come javascript, though I'm not sure how to then pass that to the model when the form is submitted? Any help would be greatly appreciated. |
Rails activejob with Sidekiq is spawning multiple jobs on perform_later Posted: 11 Oct 2016 03:49 AM PDT I have an fairly simple Rails 5 app for monitoring sites speeds. It sends jobs off to an external page speed testing service and periodically checks to see if the jobs are complete, and if so it calls and stores the data about the page. Each project can have many pages, and each page can have many jobs, which is where the response from the testing service is stored. There is an activejob, with a sidekiq backend, that is supposed to run every minute, check for pages that are due to run, and if any are found launch a job to enqueue it. It also checks if there are any enqueued jobs, and if they are found, it spools up a job to check the status and save data if it's complete. #Check any jobs in the queue, then schedule the next task GetrunningtasksJob.perform_later FindjobstorunJob.set(wait: 1.minute).perform_later() end This seems to work as expected for a while, but after 5 minutes or so two jobs seem to end up spawning at the same time. Eventually each of those spawn more of their own, and after a few days I end up with tens of thousands trying to run per hour. There's no errors or failing jobs as best I can tell, I can't find any reason why it'd be happening. Any help would be mundo appreciated :) |
rails how to get the following query in rails Posted: 11 Oct 2016 04:41 AM PDT I need to get the following output in rails how do i do it? I tried: |
Get a model reference from ActiveRecord_Associations_CollectionProxy object Posted: 11 Oct 2016 04:41 AM PDT I have two Active Record Models I would like to get the reference of the class Post from the activerecord association. Currently when I do Is there a way I can get Post without having to "split" the string on "::" and then constantize it ? |
wrong number of arguments Contact#create Posted: 11 Oct 2016 03:40 AM PDT I have this error :
it show me this line from my view My create method in contact_controller take no arguments contact_controller.rb and i'm supposed to display those message from my model contact.rb I do not understand what arguments ruby wants. anyone know what is it ? |
Devise yielding password in plain text? Posted: 11 Oct 2016 03:02 AM PDT I just stumpled upon something strange while writing specs for my User model (using Devise 4.2.0): How is this even possible? Its not visible in the create statement: But nevertheless accessible from the console? Anyone who can shed some light on whats happening here? |
Ruby on Rails - Editor only for code Posted: 11 Oct 2016 02:50 AM PDT In my previous applications I have used Now I am building a application where only codes will be edited (mostly Problem with Can I achieve this without any Something like image below |
Rails how to version the models? Posted: 11 Oct 2016 05:50 AM PDT I have created rails application using rails 5 and ruby 2.3. |
js doesn't load properly with ruby on rails Posted: 11 Oct 2016 06:39 AM PDT On my index I have Here is the html part which doest work: Thanks a lot for your help. |
Undefined local variable or method Rails4.2 Posted: 11 Oct 2016 02:24 AM PDT Im new in RoR and I need your help. Here is my problem;
Here is my code. Controller Mailer Thank you. |
Selenium+Ruby issue because of page reload Posted: 11 Oct 2016 03:16 AM PDT I've the following code: My problem is the 3rd and the 4th line. When selenium clicks the first element, it causes a page reload. The problem is that the 4th line (the wait.until) finds the element BEFORE the reload is executed. So what happens? Selenium thinks the element is already loaded, it try to continue and after that the pages reload and selenium throw out an error, cause it can't find the element. What can i do? The code works fine when i put a sleep between this lines, but i don't wan't to use sleep cause of bad practice. Is there another way? Thanks for your help! |
Rails favicon on deeply nested routes Posted: 11 Oct 2016 01:49 AM PDT I have the following And it just works with routes And does not work with favicon.png sits in assets/images and I just copied to public folder as well, but it does not make difference. Also there is no error in inspector (chrome) and between heads Looks like it picks the image up, but it does not render it or what? And yes, eventually I don't see icon generated in chrome bar (I see the following): |
Rubymine - connect to database in docker container Posted: 11 Oct 2016 01:16 AM PDT I successfully set up my development environment for a Rails project using Docker: the server runs in a container and the database in another linked container. Here is my Now is there any way I can connect to my development database from within Rubymine? |
Posted: 11 Oct 2016 02:43 AM PDT I just decided to start learning sass but am still struggling a bit to run sass on my pc.I downloaded and installed it already as the pictures show: The folder that I have the project is inside the htdocs folder in the xampp folder. I typed C:\Users\Thulani>sass --watch C:\xampp\htdocs\ruby\lib\sass\style.scss:style.css on the command line but it only says sass is watching for changes. How can I actually make changes in my style.scss and see those changes? Here my html: Please help |
Ruby on Rails - old version deployment Posted: 11 Oct 2016 01:15 AM PDT How to deploy a ruby on rails version 1.x application on a ubuntu server with Apache and Phusion passenger. Since it's a very old version I don't find any documentation and guides. Also, wondering about setting it up locally as there's no Gemfile. |
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