Only show first letters of string of each word | Fixed issues |
- Only show first letters of string of each word
- Rspec: How to use expect to receive with a resource which does not exist yet?
- Issue staring docker container with nginx and passenger
- How do I set up Devise with Angular2?
- Web server and application server Ruby on rails
- Rails, deleting from grid works, but I get a wierd exception
- Rails + Ec2 + multiple environment
- Rails routing for Redmine Plugin - ActionController::RoutingError (uninitialized constant
- Show a selectbox with all registers that employee using or no associations
- Ruby on Rails Devise master password
- heroku custom domain with cname for staging app
- How to handle HTTP authentication for web app which will be accessed by other third party applications only?
- Rails in a subdirectory behind apache reverse proxy
- How to display the button in one line after the input tag, which is embedded in a div block?
- How to prevent acts_as_votable from redirecting or refreshing? (Rails gem)
- swap hash1 keys with hash2 values
- NoMethodError while rendering a partial
- out of stock in spree app
- Rails 4 and Mongoid nested has_one relationship not working?
- Solr Sunspot - Reindexing objects is not automatically running
- migrating From Prototype to jQuery what will be equivalent of new Ajax.updater
- Is it a good practice to use Enum for the type field in STI?
- How can i get country name in Rails?
- "Cannot redirect to nil!"
- how to convert duedate.date to duedate.datetime in rails after migration
- Starting one delayed job in Rails creates two processes
- Rails routing: Scope using a database field
- how to redirect to dashboard when visit certain page using ActiveAdmin
- Rails, ActiveRecord and SubQueries
- Updating a local gem with c extensions
Only show first letters of string of each word Posted: 14 Apr 2016 07:21 AM PDT I have this string I have looked around to find an easy way to get the first letters of each word. Because I want my end result to be: Is there a special ruby on rails function for this? If not, how can I achieve such thing? I found this But I was hoping if there is even a simpler method |
Rspec: How to use expect to receive with a resource which does not exist yet? Posted: 14 Apr 2016 07:07 AM PDT In an action called via a post request I'm creating a resource call RequestOffer and send an email with ActionMailer using the created resource as a parameter: When my controller spec, I want to test that my RequestOfferMailer is called using the method email_team with the resource @request_offer as a parameter. When I want to user expect(XXX).to receive(YYY).with(ZZZ), the only way I found was to declare my expectation before making the POST request. However, ZZZ is created by this POST request, so I have no way to set my expectation before. Any idea how to solve this problem? |
Issue staring docker container with nginx and passenger Posted: 14 Apr 2016 07:04 AM PDT I am getting this weird issue in my docker container when I try to starting it. The container is trying to run a rails 4 app using nginx and passenger, but I am using the package ulyaoth-nginx-passenger5 that install nginx already build with passenger. This configuration is working right outside the container in a VPS. The message is: nginx: [alert] could not open the passenger log file for writing during Nginx startup, some log lines might be lost (will retry from Passenger core) (2: No such file or directory) Any ideas how to fix it? You can check the docker file here: https://gist.github.com/victorsosa/7fe84b94d6f525021ac1f783adddf86b |
How do I set up Devise with Angular2? Posted: 14 Apr 2016 06:33 AM PDT Things I want to know are:
I'm making some researches on my own, so I will answer on this questions too. So, my goal is to make a FAQ about pairing Devise with Angular2. Or maybe there if there is an article about that already -- I will be more than thankful. |
Web server and application server Ruby on rails Posted: 14 Apr 2016 06:43 AM PDT Best practice for Scalable project on ruby on rails. Problem: I don't understand the difference between web and app server in ror projects. I understood that the differences between application and web servers are webserver handles requests and application has business logic. However I don't quite understand how I can implement it in my ruby on rails application. So, I have, for example, two instances and ruby on rails application. On the first server I want to set up a web server, and on the second one I want to install application server. But, for example, I use passengers as my webserver that makes easier to deploy my ror application. So, will I have any benefits implementing such logic? Can I use passenger as an cache server or something like this? Is it possible to put passenger on another server and send request to ror application? Or I totally wrong and don't understand the conception? Note: I just found amazon web application hosting architecture and now I'm trying to figure out how I can it implement and how it could work. |
Rails, deleting from grid works, but I get a wierd exception Posted: 14 Apr 2016 06:20 AM PDT I have created a grid with the wice_grid gem and I am trying to add a delete button on every entry. My html is the following: Any in my controller: The delete function actually works, it does indeed delete the item, but then I get an ActionController Exception saying that the object can't be found It seems to me like I delete it and then search for it again, but I don't understand why. Here's a screenshot of what I get when I click on the Delete link. When I refresh the item is gone, which means that the delete function works. I tried searching but I found nothing so specific. Any help appreciated. |
Rails + Ec2 + multiple environment Posted: 14 Apr 2016 06:19 AM PDT I am ROR developer and I am getting one issue. Please read the details below about issue. I have deployed my Rails application on Ec2 server and I am managing 3 environment (staging, testing, production) on single Ec2 instance and I am using nginx + passenger server. I am using those environment via port number. for example staging url: http://ec2ipaddress:8080/users/sign_in testing url: http://ec2ipaddress:5000/users/sign_in now what issue I am getting suppose I am running my application(in staging environment) on any browser then after few hours it says like refused connection and it does not display anything in browser. and then if I change port number from 8080 to 5000 and hit then it works and again revert my port number 5000 to 8080 then it works fine. I have checked the server logs and when it block then no request comes on server. if anybody know please help me. Regards, R.K. |
Rails routing for Redmine Plugin - ActionController::RoutingError (uninitialized constant Posted: 14 Apr 2016 06:29 AM PDT I am new in ruby-on-rails and i am trying to develop plugin for Redmine. I have next configuration: Then i created Redmine plugin in next way: Finally, when i try to access http://localhost/requirements, i have next error and error in the log file: Page not found The page you were trying to access doesn't exist or has been removed. Could anyone help me to fix it? Thank You in advance! |
Show a selectbox with all registers that employee using or no associations Posted: 14 Apr 2016 06:39 AM PDT So, I have a model Refinancing belongs to employee and employee has many refinancings. This employee can have many register (but register is just a column). In view refinancing, how make for show a selectbox with all registers? I tried but don't work. I need show all register that employee. What I do? |
Ruby on Rails Devise master password Posted: 14 Apr 2016 06:34 AM PDT I'm trying to implement the master password feature for Devise with my User model but after following the wiki article I'm getting the following error when trying to start my rails server: So, it indicates there is an error on line 142 in my User model. For the time being, I just cut and pasted the code straight from the wiki to get the implementation going. models/user.rb Is there something else that I need to do to get this working? Based on what Devise says, it should pretty much be a cookie-cutter implementation. |
heroku custom domain with cname for staging app Posted: 14 Apr 2016 06:14 AM PDT I host my personal website on heroku with a custom domain name, pointing to my heroku app with cname. I am doing the same thing for another app(as staging app) as staging.mywebsite.com. The problem is that when I visit the original heroku url for my staging app it works fine, but when I visit staging.mywebsite.com "No such app" error shows up. Any ideas? Thank you! |
Posted: 14 Apr 2016 06:09 AM PDT I am building a rails application which has both API and UI, i have implemented HTTP token authentication(header) for API and want to continue with same for web app as well(If possible). I am saving the user token in a session[:token] and using authenticate_or_request_with_http_token method for authentication. The application_controller has the before filter and all other controllers are inherited hence it requires HTTP header token for every endpoint in API and every page in the web app. API is working fine because the partner application sends token every time to access endpoints but in case of web app we are getting token for the first time (when the user gets redirected from the partner app) and control gets transferred to our app. Then we need a way to send HTTP header token for every route/page inside the rails app.Please suggest me a way to do that, or a completely different approach if this seems so complex. |
Rails in a subdirectory behind apache reverse proxy Posted: 14 Apr 2016 06:20 AM PDT I don't get it. I tried to run a Rails app behind an apache reverse proxy. I'm using Unicorn on port 8080. Apache VirtualHost This basically works. A request to http://domain.tld/foo/ arrives at the Rails app. What follows is a redirect to an authentication mechanism using the following in As expected, I will be redirected to http://domain.tld/sessions/. Now I'd like to configure Rails to redirect to http://domain.tld/foo/sessions/ globally, without explicitly mentioning it with every redirect. I tried using this in config/environments/production.rb: And starting Unicorn with this: Unfortunately, this does not work. It doesn't change the behaviour at all. I've added debug output before the redirect to see, what's going on. This prints out: Can anybody tell me why Rails does not take the configuration into account? |
How to display the button in one line after the input tag, which is embedded in a div block? Posted: 14 Apr 2016 05:56 AM PDT For nested forms I use gem coocon. I have next view _poll_item_field.html.erb Generated html There is a field for input with class ctrlenter expanding, after two buttons "up" and "down" to be added . At the moment, these buttons are displayed after the input field on the next line, and it is necessary that they were in one line in place with input field. What styles I should add in order to realize this? I added in _layout.sass But dont wotk |
How to prevent acts_as_votable from redirecting or refreshing? (Rails gem) Posted: 14 Apr 2016 05:23 AM PDT I just se the acts_as_votable and its working properly but the problem is it redirecting to the post's link and when I add It refreshes the page, any suggestions? |
swap hash1 keys with hash2 values Posted: 14 Apr 2016 06:20 AM PDT What's the shortest way to swap this is the result I want to have after the swap: |
NoMethodError while rendering a partial Posted: 14 Apr 2016 05:22 AM PDT I have a
|
Posted: 14 Apr 2016 05:02 AM PDT I am trying to work with a I want to mark one of the variants of my product out of stock. How can I do that in a To the same product, in the front-end I want to show out of stock option there. But I am not sure how can I mark that product out of stock and vice-versa. Anyone else tried this? |
Rails 4 and Mongoid nested has_one relationship not working? Posted: 14 Apr 2016 06:21 AM PDT I'm having a problem with a has_one relationship inside an embedded relationship. The relationship is recipe embeds_many ilist, ilist has_one ingredient. I am using a single form for this but when I submit the ingredient is not stored in the ilist. recipe model recipe controller ilist model Ingrediant model(I know I spelled ingredient wrong) form: In the HTTP post in the console I can see the recipe post along with 56ccc8b7de301b1904488361 is the _id for chicken breast in the ingredient database, i don't want just the _id i need to be able to query the whole ingredient. The idea is that each ilist contains all the information from an ingredient as well as the quantity so I can calculate the nutritional values of the recipe through the controller on create(not sure how to do this but one problem at a time). |
Solr Sunspot - Reindexing objects is not automatically running Posted: 14 Apr 2016 06:09 AM PDT i'm using Sunspot Solr for indexing and searching in our Ruby on Rails application with MangoDB database (Mongo mapper) The searching works well, but objects aren't automatically indexed to Solr when i make changes on my database. I tried manually index on a class itself: Or, I added on sunspot.yml : auto_commit_after_request: true I also autocommit with some interval on solrconfig.xml : All this solutions failed to reindex automatically my objects, unless i reindex all objects with rake task : Any other solutions ? Thanks a lot. |
migrating From Prototype to jQuery what will be equivalent of new Ajax.updater Posted: 14 Apr 2016 05:00 AM PDT The below code need to migrate from prototype to jQuery i have written the equivalent of this code but have doubt in how to handle {success: 'added_udf_filters'} in jQuery The Equivalent code which i have written in jQuery is |
Is it a good practice to use Enum for the type field in STI? Posted: 14 Apr 2016 06:58 AM PDT I have a requirement to list all the type values of STI. So I would like to maintain all the possible values of type. Is it a good practice to make the type field an Enum in the parent class? |
How can i get country name in Rails? Posted: 14 Apr 2016 05:20 AM PDT I am developing I tried Any other way. Thanks |
Posted: 14 Apr 2016 06:00 AM PDT I'm following along with Michael Hartl's rails tutorial and making small adjustments. Users can make microposts (status updates) on their profiles, at which point the page will appear to reload and their new status will be displayed. I can confirm by hand that this works exactly as intended. The problem is that tests for it aren't passing for some reason, even though the end result outside of tests looks perfect. Screenshots of microposts_controller.rb, microposts_interface_test.rb (the failing test), related error messages, and users_controller.rb, in that order: http://imgur.com/a/IS1HI
I understand that, for some reason, this is saying that The fact that every other test passes is already proof of that, but just to go the extra mile, I've confirmed that the failing |
how to convert duedate.date to duedate.datetime in rails after migration Posted: 14 Apr 2016 03:52 AM PDT I have a small problem that i am facing. When i started the project i used scaffold and defined due_date field as Date now i want to do some date calculations. and i need to change the due_date field to Datetime . Can sm1 help me with this I know how to add new fields to table and delete but i am stuck at changing the attribute of already existing Model. I have tried everything. Please let me know if there is any special code i can run in terminal to edit the attribute and create migration file. P.s- Someone told me changing the schema file is bad. so i cant edit it directly. |
Starting one delayed job in Rails creates two processes Posted: 14 Apr 2016 06:02 AM PDT Initially I have no process for delayed jobs(as indicated by htop), then when I run the command So why is this happening? The other delayed job consumes memory where I don't have much of it!, however its TIME+ is zero, so it didn't consume time, so what does this means ? |
Rails routing: Scope using a database field Posted: 14 Apr 2016 05:38 AM PDT I am creating an multitenant app based on ideas from Ryan Bigg's book "Multitenancy with Rails". In this book, the tenants has their own subdomain. This approach is not applicable in my case, so I'm trying to scope by a slug of the account's name instead. So instead of URLs like Here's a piece of my routes.rb: To achieve my goal, i try to follow the routing guide on rubyonrails.com (the last code snippet in chapter 4.5), and change the above code to:
This change seems to correct my routes: .. but it also seems to break my site, as the slug is not fetched from the database. I can't seem to wrap my mind around how this I have googled around for a couple of days now, and read numerous answers here on Stackoverflow. Nothing helped, so any pointers is greatly appreciated. :-) |
how to redirect to dashboard when visit certain page using ActiveAdmin Posted: 14 Apr 2016 03:30 AM PDT i`m using ActiveAdmin gem in my Rails Application, i added some role to give user privileges, a basic admin can not access certain menu. I have remove the menu by using this code if type admin is basic admin The problem is, the basic admin still can access that menu even though i have removed it via URL typed. Are there any solutions to restrict the basic admin to access that page? My idea is to not Register that page at all if admin type is basic admin |
Rails, ActiveRecord and SubQueries Posted: 14 Apr 2016 07:05 AM PDT I have a postgresql database with hourly gas consumption entries. Now, I need to find the days with the highest consumption for every month. In plain SQL I'd use subqueries like this: However, I don't know the best way (or any way) to do this in rails. I appreciate any input. Should I bypass ActiveRecord? Performance is a high priority. Thank You! |
Updating a local gem with c extensions Posted: 14 Apr 2016 03:13 AM PDT I've cloned a gem from github and using it locally by providing local path in Gemfile. The gem has c extension that I want to make some changes to. I made changes in a file located at ext/my_file.c and ran the bundle install command. The changes are not reflecting. What else should I do to reflect the changes? Your help is appreciated. |
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