Rendering tables using bootsy WYSIWYG editor | Fixed issues |
- Rendering tables using bootsy WYSIWYG editor
- Devise install error rails application
- Form not submitting as remote rails 3
- Rails - object that belongs to multiple other objects
- Trouble with accepts_nested_attributes_for in Rails 5.0.0.beta3, -api option
- How to make factory_girl transient work with association?
- Rails 4: mail_to helper adds HTML attribute target="_blank"
- Removing folders from my rails app with rake [migrated]
- Adding classes to fields in customized Rails form templates
- Change form_for submit label without changing passed parameter
- byebug and web-console not working in view
- method on model returning empty during rspec tests even though it should have a value
- Build factories for self referential associations in rails
- Active Admin pagination for array on custom page
- rails checking the existence of child objects
- Can't get url for both images with rails and paperclip
- rails wash_out gem output
- Ruby on Rails: Prevent users back to login form after logged in successfully
- backend with ajax to detect if user is no longer active
- Rails: process partials with loop, add additional class for the first item
- Server rendering with rails + react-rails gem + react router
- Different behavior of TCPSocket with rails app
- Paperclip / AWS-SDK Uninitialized Constant Aws::S3::Errors
- ruby : regex replace string beetween two char [ ]
- How to call Rails console on server, if it uses Mina?
- Rails activerecord query with has_many belongs_to association
- Rails. Count records that have a specific attribute:string
- ActiveAdmin: how to add formatter to any column with specific name?
- Rails - What is the best way to display default avatar if user doesn't have one?
- has_one and has_many relationships to the SAME object type
Rendering tables using bootsy WYSIWYG editor Posted: 11 Mar 2016 06:41 AM PST I would like to be able to add tables to the html content of a bootsy editor. I have enabled the html toolbar button. When I edit the html and add table tags and return to regular mode, the table tags get stripped and replaced by spans. |
Devise install error rails application Posted: 11 Mar 2016 06:40 AM PST First time trying out devise. I added it to my gems but receive the following error message when I run $rails g devise:install. I also tried $ bundle exec rails g devise:install. I also looked in the routes.rb file, as others have suggested, and there is nothing there about devise. Thanks in advance....Mitch [!] There was an error parsing # from /Users/charlesmcbee/Desktop/wyncodework/practice/movie_review/Gemfile:16 # ------------------------------------------- # # gem 'therubyracer', platforms: :ruby
|
Form not submitting as remote rails 3 Posted: 11 Mar 2016 06:33 AM PST I am integrating a bootstrap theme into my rails 3 application, i have a form(Complicated form having multiple partials) defined as remote => true but that form is getting submitted as html. However i tried to do the same for my login form with only 2 fields and it worked. I am confused as to what could be going wrong. Can anyone please help. |
Rails - object that belongs to multiple other objects Posted: 11 Mar 2016 06:57 AM PST Take the following associations based on a Feedback model: feedback.rb The reverse associations are When Say in this example we want to primarily link it with the buyer and so or is it more appropriate/correct to reference? Is this even valid without an explicit buyer model?What is the Rails way to then incorporate the other |
Trouble with accepts_nested_attributes_for in Rails 5.0.0.beta3, -api option Posted: 11 Mar 2016 06:53 AM PST I am using Rails 5.0.0.beta3, building an API-only app using the -app option on rails new, and I am having trouble with accepts_nested_attributes_for. In my app, a create (or a new, then a save!) of an object with nested attributes fails, with a message that the parent parent object must exist. To test, I made a new app and used just the test case with members and posts in the ANAF documentation: and (These class definitions were generated by the Rails scaffold generator, so the inherit from ApplicationRecord, rather than ActiveRecord::Base, but per this post, that is not significant.) With those classed defined, and matching migrations created and run, I launch a Rails console and follow the steps in the doc: And then: No joy! When I split the create into new, then save!, I get the same result, with a somewhat clearer error:
Any thoughts on why this sample code in the documentation is be working? Could something be wrong in my environment? Does the -api option break something in ActiveRecord? BTW, I am using PostgreSQL Thanks! |
How to make factory_girl transient work with association? Posted: 11 Mar 2016 05:58 AM PST Previously I had a factory looking like this: And when I built the factory using and it worked fine. Now I had to refactor models a little bit. Before So, my factory looks like this: So, not much changed, but I am passing attachment_id now to association. When I run the tests, I get For clarity this is my new What am I doing wrong here? How should I pass attachment_id transient through association in Factory Girl? |
Rails 4: mail_to helper adds HTML attribute target="_blank" Posted: 11 Mar 2016 06:14 AM PST I am using
And it creates HTML as follows,
This works fine as it opens default mailer application to draft the email. But the issue is, due to it was added I tried with no luck to find where it was added and how to prevent this. Please can anyone help out with this problem? |
Removing folders from my rails app with rake [migrated] Posted: 11 Mar 2016 05:50 AM PST So I'm trying to remove the Thanks in advance |
Adding classes to fields in customized Rails form templates Posted: 11 Mar 2016 06:39 AM PST I'm trying to create a template to my Rails app forms using this recipe here, i.e., customizing the file lib/templates/erb/scaffold/_form.html.erb. All I want is to make all the inputs with type="text" to have the same class="form-control", because I'm using Bootstrap 3. Now, all these inputs are generated by this line in the template: My problems are:
May someone help me with some clue about what to do? Or at least explain me the systax of the line generating these inputs now, so I can continue myself? Thanks in advance! |
Change form_for submit label without changing passed parameter Posted: 11 Mar 2016 06:53 AM PST I have two submit button for my form_for: one is to save as draft, the other one is to publish. To deal with post's status (published or draft), I did this: I pass the "status" parameter, and it takes as value either "published" or "draft". The issue is that the value is the label of the button. I'd like to change the label, but not the value. I tried to add: to each button but didn't seem to work. How could I do this ? |
byebug and web-console not working in view Posted: 11 Mar 2016 06:44 AM PST In my Rails application, I am able to use byebug in controller. However, neither adding 'byebug' or 'console'[1] in view is helping me get to a debug console. I am using haml, thus it's not "<% console %>". In other words, the lines (one of the two at-a-time) I used in the view are: I haven't tried Pry or Pry-debug, but apparently they also don't work in views? Am I using these gems incorrectly or is there another way to add debugs in views? Thanks, Kumar |
method on model returning empty during rspec tests even though it should have a value Posted: 11 Mar 2016 05:22 AM PST I am doing the following rspec test to test my '#clubs' method The method in my User model: When I run the test and use Can anyone give me a heads up to why it may not be returning the record? It's worth noting that I am adding this test after the method was created. In the console the method behaves as expected. |
Build factories for self referential associations in rails Posted: 11 Mar 2016 04:47 AM PST I have a typical requirement, I have to address user object as follows Basically, user can refer more than one person and one person should be referred by one particular user. So I build associations as follows. They are working great. Now I would like to test assoications in Rspec. I am using factory girl so any one help me to build factories. |
Active Admin pagination for array on custom page Posted: 11 Mar 2016 04:40 AM PST Im working on a custom active admin page that has a query to pull all records from two models in Rails and show them in most recent order. As a result, I get an array back. Using that, Im trying to paginate it on the custom made page in active admin, that was made using their register_page method. Relevant code for register_page I cannot get ActiveAdmin to paginate the query and I've tried to get round it doing the following.
Any help would be greatly appreciated. |
rails checking the existence of child objects Posted: 11 Mar 2016 05:35 AM PST I have a Rails 4 app. User has_one profile. When sby registers he/she is already a user, but he/she will have only profile after submitting profile form. On my users page I would like to display all the users that have profile. There are a few ways to display users with existing profile but I don't know which one is the preferred.
|
Can't get url for both images with rails and paperclip Posted: 11 Mar 2016 04:22 AM PST I have installed paperclip in my rails application, everything works fine but the problem is that I added two images for my Customer entity and when I return a Customer in the front-end (through API call) side I only get 1 url. This is the code: Console log of the Customer entity: As you can see I have the image_path path: /system/customers/... but I don't have the header_path path, just the content, the file size, name and date. Here is the model: Migration: The strange thing is that in the console and in the back-end admin part I can upload and see both images, and if I type Customer.first.header_path in the console I can see the correct path. But when I send the Customer through the api I have this problem. Here is the function that return the customer: Do you know what am I missing? |
Posted: 11 Mar 2016 04:54 AM PST I'm trying generate this output. thanks |
Ruby on Rails: Prevent users back to login form after logged in successfully Posted: 11 Mar 2016 05:29 AM PST Ok. I have a login page. After I entered the email and password correctly and it redirects to me to the user profile. When I hit the browser back button, it also redirects to the user profile which works fine. But the problem raises when let's say if I enter the email or password wrongly, it says "email/password incorrectly", and I enter second time correctly it redirects me to the user profile, but when I hit the browser back button, the page will show "Comfirm form resubmission". This doesn't make sense. |
backend with ajax to detect if user is no longer active Posted: 11 Mar 2016 04:26 AM PST I'm trying to create a heartbeat that runs at a set interval, to make sure the user is still on the page. Which I've done: now what I'd like to do on the backend is change the status to Is it to have it update a column in the DB and have a background job constantly running? or is there some much more efficient way? |
Rails: process partials with loop, add additional class for the first item Posted: 11 Mar 2016 04:09 AM PST I'm trying to implement some kind of image gallery. And I decided to use partials with an image snippet inside. For each image category the partail is added 5 times per page. Actually it's pretty easy: But the problem is the first div in a row should have an additional class |
Server rendering with rails + react-rails gem + react router Posted: 11 Mar 2016 04:41 AM PST I have create this sample repo that use rails (v4.2.6) with react-rails (v1.6.2) and react-router (v2.0.0-rc5): https://github.com/pioz/rails_with_react_and_react_router_example In the file The component All works fine, but if I change the option How can I render this app server side? Is this the right way to do this? |
Different behavior of TCPSocket with rails app Posted: 11 Mar 2016 04:49 AM PST i have a problem on one of my rails app developpement. I use heroku to deploy my rails app (prod env). And i have a misunderstanding between dev and prod environnemnt. When i excecute "require 'socket'; TCPSocket.new(nil, 80)" in my rails console in dev env (rails console, on my computer in local) and the same commande in the rails command of heroku (heroku run rails console), i don't have the same result. In dev env, i get "#TCPSocket:fd 18" then no problem occured but in prod env i get "Errno::ECONNREFUSED: Connection refused - connect(2) for nil port 80 from (irb):1:in from (irb):1 from /app/vendor/bundle/ruby/2.3.0/gems/railties 4.2.5/lib/rails/commands/console.rb:110:in `start' from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start' from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console' from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `' from /app/bin/rails:9:in `require' from /app/bin/rails:9:in I have the same environnment (same version of ruby, rails, etc...) So, if one of you as already met the problem before or could explain me the behavior of TCPSocket in that case. Thank you in advance. |
Paperclip / AWS-SDK Uninitialized Constant Aws::S3::Errors Posted: 11 Mar 2016 03:00 AM PST I've been pulling my hair out all morning trying to fix this, and have consulted every other SO post about Paperclip/AWS issue, but none of the fixes described in them seem to apply to my situation. Whenever I try to upload an image to S3 with Paperclip configured to use S3 storage, I get the following exception: Paperclip config works fine locally, as well as in the production server's rails console (e.g., defined?(Aws::S3::Errors) returns "constant"). Gemfile Model I've tried reverting to aws-sdk-v1, but I get the same exception when I try to use the app to upload assets to S3. Anyone else having this issue?? |
ruby : regex replace string beetween two char [ ] Posted: 11 Mar 2016 05:57 AM PST i want to remove text in string beetween [ ]: ex: result: i use help me define a regex-here. |
How to call Rails console on server, if it uses Mina? Posted: 11 Mar 2016 02:52 AM PST Before implementation Mina on server, I called it with: now I get: How can I call it now? |
Rails activerecord query with has_many belongs_to association Posted: 11 Mar 2016 04:00 AM PST I have two ActiveRecord models: User and Course. Which are associated as following: Now my question is: how can I get the last course of each user? I tried following: But I'm doubt on its performance. So looking for best solution with good performance. Thanks in advance. |
Rails. Count records that have a specific attribute:string Posted: 11 Mar 2016 02:34 AM PST I have a model with a string attribute. This attribute (status) is updated to I would like to count all records where Looking at the docs here it looks like it should be something like; but this is not correct, it returns a count of all instances regardless of status. How can I achieve this? |
ActiveAdmin: how to add formatter to any column with specific name? Posted: 11 Mar 2016 02:49 AM PST I have a helper called Usage example: The questions is: Is there a way to automatically format column value with my custom helper? So I would just write Overwriting |
Rails - What is the best way to display default avatar if user doesn't have one? Posted: 11 Mar 2016 02:29 AM PST Right now, each time I need to display a user's avatar, I have if statements that check whether they uploaded an avatar or not. I know it's definitely not DRY if I have these statements littered through my html. So, what's the best way to find out which image to display? Edit: I'm using Carrierwave (Paperclip didn't work for me for some reason) |
has_one and has_many relationships to the SAME object type Posted: 11 Mar 2016 02:16 AM PST I'm writing a website using Ruby on Rails and I have a number of polymorphic relationships but I want two particular relationships that are: When I generate the polymorphic code for C using Rails it seems that the has_one A/C relationship expects functions of form: whilst the has_many B/C relationship expects functions of form So is there a way to do what I want or do I have to make the A/C relationship has_many and add additional checking to ensure that it acts like has_one? |
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